RFR: 8279216: Investigate implementation of premultiplied alpha in the Little-CMS 2.13
Sergey Bylokhov
serb at openjdk.org
Tue Mar 21 21:50:33 UTC 2023
Support of premultiplied alpha is added to the "accelerated" code path of the CMM. It is implemented on top of the new feature added to the littlecms library in 2.13 and 2.15.
The next formats are now "supported": TYPE_INT_ARGB_PRE, TYPE_4BYTE_ABGR_PRE, and any custom images which use the ComponentColorModel+8-bit-precision like RGBApre or ApreBGR.
After this patch, we will fully support all our standard types(8-bit precision), and mostly any combinations of blits between them, having two exceptions:
* lcms does not convert pre-alpha for transparent src if dst is opaque
* lcms does not set correct alpha(=1.0) for transparent dst if src is opaque
Both of them are "features", so we probably need to implement a workaround someday, but for now we will use our generic/slow code.
Performance results for the ColorConvertOp.filter() for images with premultiplied alpha.
| Test | Base(avgt in us/op) | Fix(avgt in us/op) | Improvement % |
| ------------- | ------------- | ------------- |------------- |
| 32 Threads, from=sRGB:size=10:to=CIEXYZ | 97| 12| 708% |
| 32 Threads, from=sRGB:size=100:to=CIEXYZ | 8 013 | 617 | 1199% |
| 32 Threads, from=sRGB:size=1000:to=CIEXYZ | 651 838 | 104 969| 521% |
| 1 Thread, from=sRGB:size=10:to=CIEXYZ | 21| 5| 320% |
| 1 Thread, from=sRGB:size=100:to=CIEXYZ | 677 | 300 | 126% |
| 1 Thread, from=sRGB:size=1000:to=CIEXYZ | 60 095 | 30 536 | 97% |
-------------
Commit messages:
- fix for the pre-2-opeque blit
- the test is updated to expose the bug in the patch
- more types
- more types to test
- Update PremultipliedAlpha.java
- 8279216: Investigate implementation of premultiplied alpha in the Little-CMS 2.13
Changes: https://git.openjdk.org/jdk/pull/13095/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13095&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8279216
Stats: 431 lines in 4 files changed: 402 ins; 7 del; 22 mod
Patch: https://git.openjdk.org/jdk/pull/13095.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13095/head:pull/13095
PR: https://git.openjdk.org/jdk/pull/13095
More information about the client-libs-dev
mailing list