Skip to content

Add bt2020 color conversion support on Beta Cuda#1267

Merged
mollyxu merged 6 commits intometa-pytorch:mainfrom
mollyxu:colorspace-cuda
Mar 4, 2026
Merged

Add bt2020 color conversion support on Beta Cuda#1267
mollyxu merged 6 commits intometa-pytorch:mainfrom
mollyxu:colorspace-cuda

Conversation

@mollyxu
Copy link
Copy Markdown
Contributor

@mollyxu mollyxu commented Feb 27, 2026

This PR is a step towards better support for HDR videos on TorchCodec.

Added BT.2020 (NCL/CL) YUV→RGB color conversion support on the CUDA decode path, with ColorTwist matrices for both full and limited range, and for both CUDA >= 13 and CUDA < 13 NPP conventions.

Known limitation:
The added test is not passing because there is an up to ~73 pixel value difference vs the CPU path, with ~5.6% mismatched elements. It does not seem to be caused by the changes in the PR. In fact, before the PR, there is an up to 71 pixel value difference, with ~59.2% mismatched elements.

This is reflected in a TODO to investigate the root cause of this difference

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Feb 27, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1267

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 1 Pending

As of commit f5ec3ee with merge base 1a7450d (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 27, 2026
@mollyxu mollyxu changed the title add bt2020 Add bt2020 color conversion support on Beta Cuda Mar 3, 2026
@mollyxu mollyxu marked this pull request as ready for review March 4, 2026 04:37
Copy link
Copy Markdown
Contributor

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks for the great progress on this @mollyxu ! I left a comment about trying full range but this look good

Comment thread src/torchcodec/_core/CUDACommon.cpp
Comment thread test/utils.py
Comment thread test/test_decoders.py Outdated
Copy link
Copy Markdown
Contributor

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @mollyxu . Ill approve now to unblock, let's still try to unskip the new test as previously mentioned.

Comment thread test/utils.py Outdated
@mollyxu mollyxu merged commit 98b6726 into meta-pytorch:main Mar 4, 2026
68 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants