audio icon indicating copy to clipboard operation
audio copied to clipboard

NV12/YUV->RGB colour accuracy and CUDA

Open gtebbutt opened this issue 1 year ago • 5 comments

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 https://github.com/dmlc/decord/issues/283#issuecomment-2151922632

gtebbutt avatar Jun 06 '24 11:06 gtebbutt