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

x265: don't subsample chroma by default #1424

Open
0n-s opened this issue Dec 14, 2024 · 4 comments
Open

x265: don't subsample chroma by default #1424

0n-s opened this issue Dec 14, 2024 · 4 comments

Comments

@0n-s
Copy link

0n-s commented Dec 14, 2024

x265 has a section of code that automatically runs when outputting 4:4:4 that obtains the bandwidth reduction of 4:2:0 chroma subsampling but without the downsides of chroma subsampling even with sharp YUV (which still adds a lot of glowy artifacts in addition to crushing fine details).

Letting x265 encode to 4:4:4 by default wouldn't meaningfully increase file size (unless the chroma is very complex, the size difference is negligible compared to 4:2:0), but it would mean it can handle cases that chroma subsampling definitionally cannot.

@silverbacknet
Copy link

It would be useful to get a survey of what hardware and software out there currently supports 4:4:4 for hevc (and av1). Historically not much but open source supports more than the bare minimum profiles (which fortunately more often means 10-bit instead of 8-bit now, at least), and defaults need to ensure wide interoperability.

@0n-s
Copy link
Author

0n-s commented Dec 14, 2024

Yes, that is one problem that may or may not exist with this. From experience, it seems realistic to be pessimistic about support for 4:4:4 even among the most popular devices. I'd like to be proven wrong, so here's my contribution to that: unexpectedly, my iOS 16 iPhone supports it just fine!

Just to make it extra convenient, here's the command to use to make an image one can test (for anyone who'd like to help with compatibility testing): heif-enc -p chroma=444 -p x265:psy-rd=2.5 ref.png -o try.heic (psy-rd needs to be enabled for the chroma quality halving to work, see code cited in OP)

@0n-s
Copy link
Author

0n-s commented Dec 14, 2024

(psy-rd needs to be enabled for the chroma quality halving to work, see code cited in OP)

Oh, forgot to mention, psy-rd is default enabled in x265 but it's disabled by default in libheif because it sets ssim tune by default, see: #1423

That issue would need to be solved, otherwise 4:4:4 chroma would not get halved quality by default.

@bradh
Copy link
Contributor

bradh commented Dec 14, 2024

Do you have metrics for each option (or combination of options)? I'm interested in how those options affect both resulting quality (objective and subjective) and file size. That could help to inform a change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants