score::gfx::YUYV422Decoder Struct Reference
Decodes YUYV422 video. More...
Inheritance diagram for score::gfx::YUYV422Decoder:
Detailed Description
Decodes YUYV422 video.
Core idea taken from https://gist.github.com/roxlu/7872352
Public Member Functions | |
YUYV422Decoder (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 |
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 | filter |
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
◆ filter
|
staticconstexpr |
Initial value:
= R"_(#version 450
)_" SCORE_GFX_VIDEO_UNIFORMS R"_(
layout(binding=3) uniform sampler2D u_tex;
layout(location = 0) in vec2 v_texcoord;
layout(location = 0) out vec4 fragColor;
const vec3 R_cf = vec3(1.164383, 0.000000, 1.596027);
const vec3 G_cf = vec3(1.164383, -0.391762, -0.812968);
const vec3 B_cf = vec3(1.164383, 2.017232, 0.000000);
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
void main() {
vec4 tex = texture(u_tex, v_texcoord);
float y = tex.r;
float u = tex.g - 0.5;
float v = tex.a - 0.5;
fragColor.r = y + 1.13983 * v;
fragColor.g = y - 0.39465 * u - 0.58060 * v;
fragColor.b = y + 2.03211 * u;
fragColor.a = 1.0;
}
)_"
The documentation for this struct was generated from the following file: