the best way convert nv12 to RGBA

Frame genereted by cuVid, color format is nv12, I neet to convert it to RGBA for later process. In NPP library, i found nppiNV21ToRGB_8u_P2C4R, which only process nv21.

How can I do the convert for best performance? convert nv12 to nv21 first?

I believe the cudaDecodeGL sample code has a function that demonstrates this (NV12 to ARGB)

1 Like

I tried this sample code, but only about 100fps for 4K at GTX 1070, even slower than libyuv at CPU.
I think GPU should performance much better in such work.

1 Like

Samples code provided by NVIDIA are generally not optimized for performance, but try to demonstrate important programming concepts with the tightest and clearest code possible. I am reasonably sure NVIDIA states as much in their documentation. Some possible courses of action (this list is not meant to be exhaustive):

(1) Optimize the baseline code provided by NVIDIA
(2) Search for a third party GPU-accelerated library (open source or commercial)
(3) Use a library running on the CPU

1 Like

Can you give CV-CUDA a try? I think it might be better than NPP…

Also just curious, how much FPS were you getting on libyuv at CPU, and what kind of CPU do you have?

Good information, but not sure, whether the original poster is still looking after 8 years.

Very true, but I was mostly interested for my own project which is relevant today, I have a UVC camera outputs NV12 directly and want to find the best pipeline with least latency to directly display it to monitor (on Windows 10).

When @tobypan said his GTX 1070 was slower than his CPU using libyuv, that really got me curious.