Skip to content

8279216: Investigate implementation of premultiplied alpha in the Little-CMS 2.13 #13095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from

Conversation

mrserb
Copy link
Member

@mrserb mrserb commented Mar 20, 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%

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8279216: Investigate implementation of premultiplied alpha in the Little-CMS 2.13

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13095/head:pull/13095
$ git checkout pull/13095

Update a local copy of the PR:
$ git checkout pull/13095
$ git pull https://git.openjdk.org/jdk.git pull/13095/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13095

View PR using the GUI difftool:
$ git pr show -t 13095

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13095.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 20, 2023

👋 Welcome back serb! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Mar 20, 2023

@mrserb The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Mar 20, 2023
@mrserb mrserb marked this pull request as ready for review March 21, 2023 21:44
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 21, 2023
@mlbridge
Copy link

mlbridge bot commented Mar 21, 2023

Webrevs

Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Results look good. This passes all my testing.

@openjdk
Copy link

openjdk bot commented Apr 7, 2023

@mrserb This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8279216: Investigate implementation of premultiplied alpha in the Little-CMS 2.13

Reviewed-by: prr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 465 new commits pushed to the master branch:

  • 723037a: 8298048: Combine CDS archive heap into a single block
  • d518dbf: 8306440: Rename PSS:_num_optional_regions to _max_num_optional_regions
  • 9cd5741: 8306436: Rename PSS*:_n_workers to PSS*:_num_workers
  • 6e77e14: 8306456: Don't leak _worklist's memory in PhaseLive::compute
  • be6031b: 8303703: Add support of execution tests using virtual thread factory jtreg plugin
  • 5a00617: 8306543: GHA: MSVC installation is failing
  • 3da987a: 8306075: Micro-optimize Enum.hashCode
  • fdaabd6: 8306581: JVMCI tests failed when run with -XX:TypeProfileLevel=222 after JDK-8303431
  • 36ec05d: 8306430: Open source some AWT tests related to TextComponent and Toolkit
  • 8346ae2: 8305942: Open source several AWT Focus related tests
  • ... and 455 more: https://git.openjdk.org/jdk/compare/f81e1def8f74e91dcf7fa3bf54531a85956dc5e4...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 7, 2023
Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait a moment. It looked all green but I didn't look close enough.
The UI of our testing dashboard showed all green but it lied.
There are 2 closed CMM tests that fail on all platforms. I'll need to understand why.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Apr 7, 2023
@mrserb
Copy link
Member Author

mrserb commented Apr 11, 2023

Sad, does it catches the difference between slow/fast implementations or some issues related to the alpha_pre support?

@prrace
Copy link
Contributor

prrace commented Apr 12, 2023

I think the test failures are somewhat spurious,
but the easiest thing to do here is for you to change one line and we'll be OK

< int firstBand = image.getSampleModel().getNumBands() - 1;
> int firstBand = byteRaster.getSampleModel().getNumBands() - 1;

@mrserb
Copy link
Member Author

mrserb commented Apr 13, 2023

< int firstBand = image.getSampleModel().getNumBands() - 1;
> int firstBand = byteRaster.getSampleModel().getNumBands() - 1;

Done. The new test is added to prove that this issue could be reproduced before the current patch.

Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ran all tests including your new one. This time everything definitely passes.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 21, 2023
@mrserb
Copy link
Member Author

mrserb commented Apr 21, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Apr 21, 2023

Going to push as commit 117c5b1.
Since your change was applied there have been 465 commits pushed to the master branch:

  • 723037a: 8298048: Combine CDS archive heap into a single block
  • d518dbf: 8306440: Rename PSS:_num_optional_regions to _max_num_optional_regions
  • 9cd5741: 8306436: Rename PSS*:_n_workers to PSS*:_num_workers
  • 6e77e14: 8306456: Don't leak _worklist's memory in PhaseLive::compute
  • be6031b: 8303703: Add support of execution tests using virtual thread factory jtreg plugin
  • 5a00617: 8306543: GHA: MSVC installation is failing
  • 3da987a: 8306075: Micro-optimize Enum.hashCode
  • fdaabd6: 8306581: JVMCI tests failed when run with -XX:TypeProfileLevel=222 after JDK-8303431
  • 36ec05d: 8306430: Open source some AWT tests related to TextComponent and Toolkit
  • 8346ae2: 8305942: Open source several AWT Focus related tests
  • ... and 455 more: https://git.openjdk.org/jdk/compare/f81e1def8f74e91dcf7fa3bf54531a85956dc5e4...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 21, 2023
@openjdk openjdk bot closed this Apr 21, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 21, 2023
@openjdk
Copy link

openjdk bot commented Apr 21, 2023

@mrserb Pushed as commit 117c5b1.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mrserb mrserb deleted the JDK-8279216_v2 branch May 24, 2023 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants