-
Notifications
You must be signed in to change notification settings - Fork 661
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
NV12/YUV->RGB colour accuracy and CUDA #3799
Comments
The idea of adding tested/fast colorspace conversions was not supported at the time in torchvision: pytorch/vision#4029 But maybe then torchaudio could host such functions |
Interesting - colour space conversion is mentioned on the |
Maybe even then some of these could be upstreamed later into torch core to be available across the board... Regarding |
Here's a fixed version of the function:
|
It seems that the decoded YUV is range-limited, so when re-converted back to RGB without taking that into account, it gets washed out (and the function above is likely not perfect, as a solid black video without clamping goes from -5 to 182, clamped to 0 to 182). |
I've noticed some odd colour space conversion issues when using the
yuv_to_rgb
function in the otherwise very helpful NVDEC tutorial - it seems to be subtly but visibly shifting colours and/or clipping the dynamic range, but I'm not certain why. Originally thought there might be issues between BT.601/BT.709/BT.2020 content, but trying other python functions using those matricies didn't seem to help; it could definitely be my error somewhere, but I wasn't able to get correct colour output on anything that'd been through the implicit NV12->YUV444 conversion step.Since there's been some discussion on moving the colour space conversion to CUDA anyway, I wanted to flag this implementation in case it's helpful. We ended up seeing a significant speed increase using that rather than applying conversions in tensor format, with all colours coming back exactly as expected.
cc dmlc/decord#283 (comment)
The text was updated successfully, but these errors were encountered: