Loading...
Searching...
No Matches

NDI PA16: P216 with a full-resolution 16-bit alpha plane after it. More...

Inheritance diagram for score::gfx::PA16Decoder:
score::gfx::GPUVideoDecoder

Detailed Description

NDI PA16: P216 with a full-resolution 16-bit alpha plane after it.

Three planes, all the same size: 16-bit luma, interleaved 16-bit CbCr at half width, 16-bit alpha. Like UYVA it has no AVPixelFormat – P216LE describes the first two planes and knows nothing of the third – so it is selected through ImageFormat::native_format.

This is what "Best available (16-bit)" delivers for a source with alpha, so mapping it to P216 and stopping, which is what the NDI input did before, loses the alpha of exactly the sources most likely to have one.

Public Member Functions

 PA16Decoder (Video::ImageFormat &d)
 
std::pair< QShader, QShader > init (RenderList &r) override
 Initialize a GPUVideoDecoder.
 
void exec (RenderList &, QRhiResourceUpdateBatch &res, AVFrame &frame) override
 Decode and upload a video frame to the GPU.
 
- Public Member Functions inherited from score::gfx::GPUVideoDecoder
virtual void release (RenderList &)
 This method will release all the created samplers and textures.
 

Public Attributes

Video::ImageFormat & decoder
 
- Public Attributes inherited from score::gfx::GPUVideoDecoder
std::vector< Sampler > samplers
 
bool hasFrame {}
 
bool failed {}
 
bool formatChanged {}
 

Static Public Attributes

static const constexpr auto frag
 

Additional Inherited Members

- Static Public Member Functions inherited from score::gfx::GPUVideoDecoder
static QRhiTextureSubresourceUploadDescription createTextureUpload (uint8_t *pixels, int w, int h, int bytesPerPixel, int stride)
 Utility method to create a QRhiTextureSubresourceUploadDescription.
 
static bool isTopField (const AVFrame &frame) noexcept
 Whether this frame carries the EVEN lines of its picture.
 
static PlaneRows planeRows (const Video::ImageFormat &fmt, const AVFrame &frame, int textureRows) noexcept
 
static QString vertexShader (bool invertY=false) noexcept
 

Member Function Documentation

◆ exec()

void score::gfx::PA16Decoder::exec ( RenderList &  ,
QRhiResourceUpdateBatch &  res,
AVFrame &  frame 
)
inlineoverridevirtual

Decode and upload a video frame to the GPU.

Implements score::gfx::GPUVideoDecoder.

◆ init()

std::pair< QShader, QShader > score::gfx::PA16Decoder::init ( RenderList &  r)
inlineoverridevirtual

Initialize a GPUVideoDecoder.

This method must :

  • Create samplers and textures for the video format.
  • Create shaders that will render the data put into these textures.

It returns a {vertex, fragment} shader pair.

Implements score::gfx::GPUVideoDecoder.

Member Data Documentation

◆ frag

const constexpr auto score::gfx::PA16Decoder::frag
staticconstexpr
Initial value:
= R"_(#version 450
)_" SCORE_GFX_VIDEO_UNIFORMS R"_(
layout(binding=3) uniform sampler2D y_tex;
layout(binding=4) uniform sampler2D uv_tex;
layout(binding=5) uniform sampler2D a_tex;
layout(location = 0) in vec2 v_texcoord;
layout(location = 0) out vec4 fragColor;
%2
vec4 processTexture(vec4 tex) {
vec4 processed = convert_to_rgb(tex);
{ %1 }
return processed;
}
void main() {
vec2 tc = score_tc(v_texcoord);
float y = texture(y_tex, tc).r;
float u = texture(uv_tex, tc).r;
float v = texture(uv_tex, tc).g;
float a = texture(a_tex, tc).r;
vec4 rgb = processTexture(vec4(y, u, v, 1.));
fragColor = vec4(rgb.rgb, a);
}
)_"

The documentation for this struct was generated from the following file: