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

8336277: Colors are incorrect when playing H.265/HEVC on Windows 11 #1525

Closed
wants to merge 1 commit into from

Conversation

sashamatveev
Copy link
Member

@sashamatveev sashamatveev commented Jul 31, 2024

  • For some reason H.265 decoder on Windows accepts proposed media format without error, but does not actually change output format.
  • For 8-bit we proposed IYUV, but decoder outputs NV12. For 10-bit we proposed NV12, but decoder outputs P010. As result colors where not correct during rendering.
  • To detect such condition we will propose media format and then read it back to determine actual decoder output format.
  • Added color conversion for P010 format, which was missing. P010 conversion is done in two stages (P010->NV12->IYUV), since color converter does not support direct conversion from P010 to IYUV.
  • Note: Color conversion from P010->NV12->IYUV and NV12->IYUV is temporary solution and will be disabled/removed once JDK-8337686 is implemented. JDK-8337686 will add native support for P010 and NV12 to Graphics.
  • Added debug trace for formats. Disabled by default.

Progress

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

Issue

  • JDK-8336277: Colors are incorrect when playing H.265/HEVC on Windows 11 (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1525

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1525.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 31, 2024

👋 Welcome back almatvee! 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 Jul 31, 2024

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

8336277: Colors are incorrect when playing H.265/HEVC on Windows 11

Reviewed-by: kcr, arapte, angorya

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 17 new commits pushed to the master branch:

  • 304704d: 8332222: Linux Debian: Maximized stage shrinks when opening another stage
  • 19d09e6: 8325445: [macOS] Colors are not displayed in sRGB color space
  • f7ad5cd: 8336389: Infinite loop occurs while resolving lookups
  • 28e3ccc: 8320232: Cells duplicated when table collapsed and expanded
  • 0fa50cb: 8337281: build.gradle assumes all modules are named "javafx.$project"
  • 41de020: 8336331: Doc: Clarification in AccessibleAttribute, AccessibleRole
  • 686a396: 8337228: Eclipse: missing dependencies in systemTests-test project
  • cb7127d: 8337229: Missing @OVERRIDES in GlassSystemMenuShim
  • 1bdb93c: 8334874: Horizontal scroll events from touch pads should scroll the TabPane tabs
  • 25ac6fe: 8319779: SystemMenu: memory leak due to listener never being removed
  • ... and 7 more: https://git.openjdk.org/jfx/compare/e3c15957488256ec53c5fb9978e336c59b69d65e...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 rfr Ready for review label Jul 31, 2024
@mlbridge
Copy link

mlbridge bot commented Jul 31, 2024

Webrevs

@andy-goryachev-oracle
Copy link
Contributor

This might sound silly, but these formats seem to differ by the way color bits are laid out in memory - would it be possible to write a utility that does the direct conversion instead of calling two conversion methods?

@sashamatveev
Copy link
Member Author

This might sound silly, but these formats seem to differ by the way color bits are laid out in memory - would it be possible to write a utility that does the direct conversion instead of calling two conversion methods?

NV12 and IYUV are different in memory layout only, but P010 is 10-bit per pixel and NV12 is 8-bit per pixel. I filed enhancement request https://bugs.openjdk.org/browse/JDK-8337686 to support P010 and NV12 directly by Graphics. I think it is better approach, then doing conversion in Media. For now this approach is good enough until JDK-8337686 is implemented.

@andy-goryachev-oracle
Copy link
Contributor

JDK-8337686

thank you for filing the RFE. Should JDK-8337686 explicitly specify that the double conversion introduced in this PR be replaced?

@kevinrushforth kevinrushforth self-requested a review August 1, 2024 22:14
@kevinrushforth
Copy link
Member

/reviewers 2

@openjdk
Copy link

openjdk bot commented Aug 1, 2024

@kevinrushforth
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@sashamatveev
Copy link
Member Author

JDK-8337686

thank you for filing the RFE. Should JDK-8337686 explicitly specify that the double conversion introduced in this PR be replaced?

I think this issue/PR should specify it. I just updated description for this PR that color conversion is temporary solution.

@andy-goryachev-oracle
Copy link
Contributor

I think this issue/PR should specify it.

The main reason to mention what needs to be corrected is to help the person who will be working on JDK-8337686 many years from now ;-)

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

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

The code changes look good. I tested it on Windows 11 and it now looks correct.

@kevinrushforth
Copy link
Member

@arapte or @andy-goryachev-oracle can one of you be the second reviewer?

@sashamatveev
Copy link
Member Author

I think this issue/PR should specify it.

The main reason to mention what needs to be corrected is to help the person who will be working on JDK-8337686 many years from now ;-)

Done.

@openjdk openjdk bot added the ready Ready to be integrated label Aug 6, 2024
@andy-goryachev-oracle
Copy link
Contributor

andy-goryachev-oracle commented Aug 6, 2024

not yet a review.
noticed an issue on macOS. to reproduce, open a clip from the ticket, hit "play" and then drag the position slider someplace else.
in the master branch, I see these in stderr:

2024-08-06 10:19:04.010 java[52568:1934744] CMTimeMakeWithSeconds(159.122 seconds, timescale 1): warning: error of -0.122 introduced due to very low timescale
2024-08-06 10:19:09.380 java[52568:1934744] CMTimeMakeWithSeconds(287.769 seconds, timescale 1): warning: error of -0.769 introduced due to very low timescale

with this change, I see an exception in com.sun.media.jfxmediaimpl.NativeMediaPlayer:1530 because VideoResolution is being constructed with width=0 and height=0

edit: on windows, this message does not appear. instead, I see the slider jumping back to the original position momentarily. this differs from macOS/master where the slider position jumps momentarily to a position nearby.

@andy-goryachev-oracle
Copy link
Contributor

on my windows 11, I hear the audio but see no video (with this PR). am I missing any codecs?

@kevinrushforth
Copy link
Member

Anything seen on macOS is unrelated to this PR. This PR only modifies Windows-specific platform code.

@kevinrushforth
Copy link
Member

on my windows 11, I hear the audio but see no video (with this PR). am I missing any codecs?

It should show the video as well. The expected behavior is that the video is shown with incorrect colors without this fix and shown with correct colors with the fix. I wouldn't expect any specific codec needed, but @sashamatveev can confirm.

@andy-goryachev-oracle
Copy link
Contributor

rebuilt the code with rm -rf ./build; /bin/sh gradlew -PCOMPILE_MEDIA=true -PBUILD_TOOLS_DOWNLOAD_SCRIPT=../build-tools.gradle clean sdk apps javadoc command.

Still see no video (but I can hear audio). What gives?

@andy-goryachev-oracle
Copy link
Contributor

andy-goryachev-oracle commented Aug 6, 2024

Apparently, one needs to pay Microsoft $0.99 for HEVC codecs
https://apps.microsoft.com/detail/9nmzlz57r3t7?hl=en-US&gl=US

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

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

the code changes look ok to me. can't test bc codec, but two other people have tested.

@sashamatveev
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 6, 2024

Going to push as commit 635a09c.
Since your change was applied there have been 17 commits pushed to the master branch:

  • 304704d: 8332222: Linux Debian: Maximized stage shrinks when opening another stage
  • 19d09e6: 8325445: [macOS] Colors are not displayed in sRGB color space
  • f7ad5cd: 8336389: Infinite loop occurs while resolving lookups
  • 28e3ccc: 8320232: Cells duplicated when table collapsed and expanded
  • 0fa50cb: 8337281: build.gradle assumes all modules are named "javafx.$project"
  • 41de020: 8336331: Doc: Clarification in AccessibleAttribute, AccessibleRole
  • 686a396: 8337228: Eclipse: missing dependencies in systemTests-test project
  • cb7127d: 8337229: Missing @OVERRIDES in GlassSystemMenuShim
  • 1bdb93c: 8334874: Horizontal scroll events from touch pads should scroll the TabPane tabs
  • 25ac6fe: 8319779: SystemMenu: memory leak due to listener never being removed
  • ... and 7 more: https://git.openjdk.org/jfx/compare/e3c15957488256ec53c5fb9978e336c59b69d65e...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Aug 6, 2024
@openjdk openjdk bot closed this Aug 6, 2024
@openjdk openjdk bot removed the ready Ready to be integrated label Aug 6, 2024
@openjdk openjdk bot removed the rfr Ready for review label Aug 6, 2024
@openjdk
Copy link

openjdk bot commented Aug 6, 2024

@sashamatveev Pushed as commit 635a09c.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants