GPU RGBA->I420 encoder (planar 4:2:0). More...
Detailed Description
GPU RGBA->I420 encoder (planar 4:2:0).
Three render passes: Pass 1: Y plane -> R8 at full resolution Pass 2: U plane -> R8 at half resolution (width/2 × height/2) Pass 3: V plane -> R8 at half resolution (width/2 × height/2)
Three readbacks. The caller concatenates Y + U + V for GStreamer video/x-raw,format=I420.
FIXME: is there any way to do it in one pass? MRTs don't seem to work due to the size limitation (same size for everyone)
Classes | |
| struct | PlaneResources |
Public Member Functions | |
| void | initPlane (QRhi &rhi, const RenderState &state, QRhiTexture *inputRGBA, PlaneResources &plane, int w, int h, const char *fragTemplate, const QString &colorConversion) |
| void | execPlane (QRhi &rhi, QRhiCommandBuffer &cb, PlaneResources &plane, int w, int h) |
| void | init (QRhi &rhi, const RenderState &state, QRhiTexture *inputRGBA, int width, int height, const QString &colorConversion=colorMatrixOut()) override |
| void | exec (QRhi &rhi, QRhiCommandBuffer &cb) override |
| int | planeCount () const override |
| Number of readback planes (1 for UYVY, 2 for NV12, 3 for I420). | |
| const QRhiReadbackResult & | readback (int plane) const override |
| Get the readback result for a given plane. Valid after endOffscreenFrame. | |
| void | release () override |
| Release all GPU resources. | |
Public Attributes | |
| PlaneResources | m_planes [3] |
| QRhiSampler * | m_sampler {} |
| int | m_width {} |
| int | m_height {} |
Static Public Attributes | |
| static constexpr const char * | y_frag |
| static constexpr const char * | u_frag |
| static constexpr const char * | v_frag |
Static Public Attributes inherited from score::gfx::GPUVideoEncoder | |
| static constexpr const char * | vertex_shader |
| static constexpr const char * | rgb_to_yuv_glsl |
| static constexpr const char * | y_flip_glsl |
| Fragment shader Y-flip: on GL, flip v_texcoord.y. On Metal/HLSL, no flip. | |
Member Function Documentation
◆ exec()
|
inlineoverridevirtual |
Execute the conversion pass. Call inside beginOffscreenFrame/endOffscreenFrame. Renders the conversion shader and schedules GPU->CPU readback(s).
Implements score::gfx::GPUVideoEncoder.
◆ init()
|
inlineoverridevirtual |
Create render targets, textures, samplers, and the graphics pipeline.
- Parameters
-
rhi The QRhi instance. state The render state (for shader compilation). inputRGBA The scene RGBA texture to read from. width Source width in pixels. height Source height in pixels. colorConversion GLSL code from colorMatrixOut() defining convert_from_rgb(). If empty, defaults to BT.709 full range.
Implements score::gfx::GPUVideoEncoder.
◆ planeCount()
|
inlineoverridevirtual |
Number of readback planes (1 for UYVY, 2 for NV12, 3 for I420).
Implements score::gfx::GPUVideoEncoder.
◆ readback()
|
inlineoverridevirtual |
Get the readback result for a given plane. Valid after endOffscreenFrame.
Implements score::gfx::GPUVideoEncoder.
◆ release()
|
inlineoverridevirtual |
Release all GPU resources.
Implements score::gfx::GPUVideoEncoder.
Member Data Documentation
◆ u_frag
|
staticconstexpr |
◆ v_frag
|
staticconstexpr |
◆ y_frag
|
staticconstexpr |
The documentation for this struct was generated from the following file:
Static Public Attributes inherited from