LYGIA Shader Library

yuv (lygia/sample/yuv)

a way to solve the YUV camare texture on iOS

Dependencies:

Use:

sampleYUV(<SAMPLER_TYPE> tex1, <SAMPLER_TYPE> tex2, <vec2> st)

Check it on Github



#ifndef FNC_SAMPLEYUV
#define FNC_SAMPLEYUV
vec4 sampleYUV(in SAMPLER_TYPE tex_Y, in SAMPLER_TYPE tex_UV, in vec2 st) {
    vec4 yuv = vec4(0.);
    yuv.xw = SAMPLER_FNC(tex_Y, st).ra;
    yuv.yz = SAMPLER_FNC(tex_UV, st).rg;
    return YCbCr2rgb(yuv);
}
#endif

Dependencies:

Use:

sampleYUV(<SAMPLER_TYPE> tex1, <SAMPLER_TYPE> tex2, <float2> st)

Check it on Github



#ifndef FNC_SAMPLEYUV
#define FNC_SAMPLEYUV
float4 sampleYUV(in SAMPLER_TYPE tex_Y, in SAMPLER_TYPE tex_UV, in float2 st) {
    float4 yuv = float4(0.0, 0.0, 0.0, 0.0);
    yuv.xw = SAMPLER_FNC(tex_Y, st).ra;
    yuv.yz = SAMPLER_FNC(tex_UV, st).rg;
    return YCbCr2rgb(yuv);
}
#endif

License

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository