Skip to content
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

8295430: Use cmsDoTransformLineStride instead of cmsDoTransform in the loop #10754

Closed
wants to merge 4 commits into from

Conversation

mrserb
Copy link
Member

@mrserb mrserb commented Oct 19, 2022

This is the request to improve the change made by the
8005530: [lcms] Improve performance of ColorConverOp for default destinations

Right now the LCMSTransform mantain the special "imageAtOnce" flags and call cmsDoTransform function in the loop per line to support the gaps betwen the lines in the images . This code can be improved by using one call to cmsDoTransformLineStride. Some discussion about this method can be found here, the full specification:

void cmsDoTransformLineStride(cmsHTRANSFORM Transform,
                              const void* InputBuffer,
                              void* OutputBuffer,
                              cmsUInt32Number PixelsPerLine,
                              cmsUInt32Number LineCount,
                              cmsUInt32Number BytesPerLineIn,
                              cmsUInt32Number BytesPerLineOut,
                              cmsUInt32Number BytesPerPlaneIn,
                              cmsUInt32Number BytesPerPlaneOut);

This function translates bitmaps with complex organization. Each bitmap may contain
several lines, and every may have padding. The distance from one line to the next one is
BytesPerLine{In/Out}. In planar formats, each line may hold several planes, each plane may
have padding. Padding of lines and planes should be same across all bitmap. I.e. all lines
in same bitmap have to be padded in same way. This function may be more efficient that
repeated calls to cmsDoTransform(), especially when customized plug-ins are being used.

Parameters:

-  hTransform: Handle to a color transform object.
-  InputBuffer: A pointer to the input bitmap
-  OutputBuffer: A pointer to the output bitmap.
-  PixelsPerLine: The number of pixels for line, which is same on input and in output.
-  LineCount: The number of lines, which is same on input and output
-  BytesPerLine{In,Out}: The distance in bytes from one line to the next one.
-  BytesPerPlaneIn{In,Out}: The distance in bytes from one plane to the next one inside a line. Only applies
                            in planar formats. 


Notes:
- This function is quite efficient, and is used by some plug-ins to give a big
  speedup. If you can load whole image to memory and then call this function
  over it, it will be much faster than any other approach.
- BytesPerPlaneIn{In,Out} is ignored if the formats used are not planar. Please note
  1-plane planar is indistinguishable from 1-component chunky, so BytesPerPlane is
  ignored as well in this case.
- If the image does not have any gaps between the pixels and lines BytesPerLine{}
  are equal to the pixel's size * PixelsPerLine.
- To specify padding between pixels, use T_EXTRA() and EXTRA_SH() to specify
  extra channels.

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-8295430: Use cmsDoTransformLineStride instead of cmsDoTransform in the loop

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10754

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 19, 2022

👋 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 Oct 19, 2022

@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 Oct 19, 2022
}
}
cmsDoTransformLineStride(sTrans, input, output, width, height,
srcNextRowOffset, dstNextRowOffset, 0, 0);
Copy link
Member Author

Choose a reason for hiding this comment

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

We do not use "planar" types, so the last two parameters are ignored.

@mrserb mrserb marked this pull request as ready for review October 21, 2022 19:57
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 21, 2022
@mlbridge
Copy link

mlbridge bot commented Oct 21, 2022

Webrevs

@prrace
Copy link
Contributor

prrace commented Nov 3, 2022

This all looks good and I see that cmsDoTransform ends up in the same place as cmsDoTransformLineStride
so the performance of the "simple" case should be no worse.

I am just waiting for my test run to complete before approving.

Hmm I wonder if this will have a merge conflict with #10459
Probably best to integrate that one FIRST because I need to co-ordinate closed changes there.
Then if this one needs a merge you can do it .. which would be tricky for me to deal with for the other one.

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.

Tests all passed

@openjdk
Copy link

openjdk bot commented Nov 4, 2022

@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:

8295430: Use cmsDoTransformLineStride instead of cmsDoTransform in the loop

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 Nov 4, 2022
@mrserb
Copy link
Member Author

mrserb commented Nov 10, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Nov 10, 2022

Going to push as commit 78a08a0.
Since your change was applied there have been 44 commits pushed to the master branch:

  • f0a6e71: 8295812: Skip the "half float" support in LittleCMS during the build
  • 79c0092: 8285635: javax/swing/JRootPane/DefaultButtonTest.java failed with Default Button not pressed for L&F: com.sun.java.swing.plaf.motif.MotifLookAndFeel
  • 0981bfb: 8296156: [macos] Resize DMG windows and background to fit additional DMG contents
  • 93fed9b: 8296448: RISC-V: Fix temp usages of heapbase register killed by MacroAssembler::en/decode_klass_not_null
  • d6e2d0d: 8296611: Problemlist several sun/security tests until JDK-8295343 is resolved
  • 102b2b3: 8292033: Move jdk.X509Certificate event logic to JCA layer
  • 1b94ae1: 8296139: Make GrowableBitMap the base class of all implementations
  • cc8bf95: 8296718: Refactor bootstrap Test Common Functionalities to test/lib/Utils
  • 17e3412: 8296615: use of undeclared identifier 'IPV6_DONTFRAG'
  • a5d838c: 8296591: Signature benchmark
  • ... and 34 more: https://git.openjdk.org/jdk/compare/91292d56a9c2b8010466d105520e6e898ae53679...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 10, 2022

@mrserb Pushed as commit 78a08a0.

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

@mrserb mrserb deleted the JDK-8295430 branch November 10, 2022 06:18
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