-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Currently, CudaDeviceInterface::convertAVFrameToFrameOutput
only supports CUDA AVFrames in NV12 format for GPU color conversion using NPP (nppiNV12ToRGB_* functions). If a decoded frame is in planar YUV420P format (e.g., from certain hardware decoders or non-8-bit content), the function raises an error due to the AV_PIX_FMT_NV12 check.
This limitation prevents GPU-accelerated color conversion for common formats like YUV420P, even though CUDA/NPP supports planar formats through functions like nppiYUV420ToRGB_*.
Proposed Change:
Extend convertAVFrameToFrameOutput
to detect and handle AV_PIX_FMT_YUV420P
in addition to NV12.
Implement the YUV420P → RGB conversion path using NPP (nppiYUV420ToRGB_8u_P3C3R_Ctx or _709CSC variants for BT.709).
Maintain the same caching logic for NppStreamContext and memory handling as in the NV12 path.
Benefits:
Broader format support for CUDA-based decoding pipelines.
Reduced need to fall back to CPU for planar YUV420P → RGB conversion, improving performance.
Improved interoperability with decoders that output YUV420P by default.
Motivation, pitch
No response