score::gfx::YUV420Decoder Struct Reference
Decodes YUV420 videos. More...
Inheritance diagram for score::gfx::YUV420Decoder:
Detailed Description
Decodes YUV420 videos.
Method was taken from https://www.roxlu.com/2014/039/decoding-h264-and-yuv420p-playback
Public Member Functions | |
YUV420Decoder (Video::ImageFormat &d) | |
std::pair< QShader, QShader > | init (RenderList &r) override |
Initialize a GPUVideoDecoder. More... | |
void | exec (RenderList &, QRhiResourceUpdateBatch &res, AVFrame &frame) override |
Decode and upload a video frame to the GPU. | |
void | setYPixels (QRhiResourceUpdateBatch &res, uint8_t *pixels, int stride) const noexcept |
void | setUPixels (QRhiResourceUpdateBatch &res, uint8_t *pixels, int stride) const noexcept |
void | setVPixels (QRhiResourceUpdateBatch &res, uint8_t *pixels, int stride) const noexcept |
Public Member Functions inherited from score::gfx::GPUVideoDecoder | |
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 |
Static Public Attributes | |
static constexpr const 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. More... | |
static QString | vertexShader () noexcept |
Member Function Documentation
◆ init()
|
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
|
staticconstexpr |
Initial value:
= R"_(#version 450
)_" SCORE_GFX_VIDEO_UNIFORMS R"_(
layout(binding=3) uniform sampler2D y_tex;
layout(binding=4) uniform sampler2D u_tex;
layout(binding=5) uniform sampler2D v_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 ()
{
float y = texture(y_tex, v_texcoord).r;
float u = texture(u_tex, v_texcoord).r;
float v = texture(v_tex, v_texcoord).r;
fragColor = processTexture(vec4(y,u,v, 1.));
})_"
The documentation for this struct was generated from the following file: