NVENC & QSV: RGB/YUV444 Texture Encoding#13152
NVENC & QSV: RGB/YUV444 Texture Encoding#13152derrod wants to merge 18 commits intoobsproject:masterfrom
Conversation
|
#8872 can be closed by this PR |
|
Updated with a couple fixes for thing I noticed while re-reviewing my own PR. But more importantly, also added support for 10-bit 4:4:4 encoding with NVENC when OBS is set to P416. This is somewhat experimental, and while it works great for SDR, I'm not familiar enough with HDR to say whether this is fully correct. It looks the same as P010 PQ though. This should also be possible with NVENC on Linux and with QuickSync on Windows, but I haven't tested that yet. |
92ad4e0 to
2c75ef0
Compare
|
Tested my specific setup (8bpc NVENC), it works great! 😀 |
|
Couple ideas that came up while chatting with some folks:
These should, in theory, fix the full range issue with QSV and allow the same GBR+YUV feature as I have for 8-bit, but require a bit more work and more complex shaders. I'll move this to draft for now since it'll probably mean removing and reworking the last 6 or so commits. Should be done later this week though, so not for long. |
|
Unfortunately my experiments with three-plane 10-bit YUV did not quite work out. I'm waiting to hear back from NVIDIA on this. For now, I've just fixed up the RGB16A2 variant based on review comments and some other issues I've found. It's probably good enough for now, though I'd love to have 10-bit GBR encoding in the future as well. |
Co-authored-by: Zhang Boyang <zhangboyang.id@gmail.com>
Technically DXGI_FORMAT_AYUV is feature level 11.1+ only, but both NVIDIA and Intel support it at 11.0 as well. AMD is the only one to enforce this, though we don't need support on their platform anyway. For correctness's sake, let's still bump it to 11.1.
Co-authored-by: Zhang Boyang <zhangboyang.id@gmail.com>
Tested on Linux with an NVIDIA GPU.
Co-authored-by: Zhang Boyang <zhangboyang.id@gmail.com>
These were added in NVENC SDK 12.0, which is the minimum we support for building.
Co-authored-by: Zhang Boyang <zhangboyang.id@gmail.com>
GPU encoding unused, raw output supported for compatibility reasons.
I tested Linux unfortunately will have to wait. I think QSV may be possible because VA-API seems to support Y410, but it seems more complex when dealing with DMABUF. NVIDIA on Linux should still work with a planar approach (triple-height |
Description
This PR implements support for encoding RGB or YUV444 with texture sharing, avoiding the CPU conversion and system memory round-trip.
Encoder Support
1 10-bit H.264 is only supported starting with Blackwell generation (RTX 50-series) GPUs
2 Windows-only as Y410 is not supported by CUDA/OpenGL. Linux 10-bit support may be possible via planar GBR/YUV with 3x16bpp planes, but would require adding additional formats to OBS.
3 Windows-only since I'm not familiar with Linux QSV, but support may be possible
Linux support for QuickSync should be possible (at least for 8-bit), but I'll leave that to people that are more familiar with the Linux side of things :)
Frontend changes
R10las a new 10-bit RGB video format (Windows only)Y410as a new 10-bit YUV 4:4:4 video format (Windows only)libobs changes
GS_AYUVandGS_Y410texture formatsobs_encoder_info.get_video_info()is now called for texture encoders to allow encoders to negotiate a format with libobsusing_p010_tex/using_nv12_texto using an enum storing the active GPU texture type (since there can only be one anyway)VIDEO_FORMAT_AYUVandVIDEO_FORMAT_R10LVIDEO_FORMAT_GBRA,VIDEO_FORMAT_Y410, andVIDEO_FORMAT_GBR10libobs-d3d11 changes
GS_AYUVtextures usingDXGI_FORMAT_AYUVGS_Y410textures usingDXGI_FORMAT_Y410DXGI_FORMAT_AYUV)libobs-opengl changes
GS_AYUVtextures usingGL_RGBAGS_Y410textures usingGL_RGB10_A2obs-nvenc
get_video_info()for texture encoders to negotiate texture formats for best performanceobs-qsv11
get_video_info()callback for texture encoders, wheredataisNULLInspired by and extended from, but also closes #13113
Also closes #8872
Motivation and Context
4:4:4 encoding is currently only available via CPU conversion (NVENC) or not at all (QSV). The primary use-case is for raw footage without chrome subsampling, for example, screen recordings that are intended for editing, where chroma subsampling results in undesireable artefacts around text.
The supported modes all have their pros and cons, hence why multiple are supported:
- No RGB->YUV conversion losses
- No subsampling
- No RGB->YUV conversion losses
- HDR support
- Support for 10-bit video may be spotty
- Reduced RGB->YUV conversion loss due to higher precision
- HDR support
Despite the alpha channel technically being included, none support it in encoded form right now (NVENC only supports alpha with RGBA or NV12 input).
Examples:*
How Has This Been Tested?
Types of changes
Checklist: