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

Clamp YUV->RGB out of gamut #2264

Merged

Conversation

RunDevelopment
Copy link
Member

This fixes a bug reported to us on discord. As I explained there, not all possible YUV values produce valid RGB. Some may produce negative RGB values. Our conversion did not account for this, and the Change Colorspace node is marked as assume_normalized for performance reasons, so negative RGB values were passed onto other nodes which did not expect them.

The fix is to simply clamp the RGB values we get from the YUV->RGB conversion.

Example: In this chain, I swap U and V which can cause invalid RGB values.
image

Before:
image

After:
image

@joeyballentine joeyballentine merged commit 240c20d into chaiNNer-org:main Oct 14, 2023
14 checks passed
@RunDevelopment RunDevelopment deleted the change-color-yuv-gamut branch October 14, 2023 20:54
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

Successfully merging this pull request may close these issues.

None yet

2 participants