obs-StreamFX/data/effects/color_conversion_rgb_yuv.ef...

24 lines
852 B
Plaintext

// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// AUTOGENERATED COPYRIGHT HEADER END
#define YUV_709_ float3x3(0.2126, 0.7152, 0.0722, -0.2126, -0.7152, 0.9278, 0.7874, -0.7152, -0.0722)
#define YUV_709_NORM float3x3(0.2126, 0.7152, 0.0722, -0.1145721060573399, -0.3854278939426601, 0.5, 0.5, -0.4541529083058166, -0.0458470916941834)
#define YUV_709_INVNORM float3x3(1, 0, 1.5748, 1, -0.187324, -0.468124, 1, 1.8556, 0)
float3 RGBtoYUV(float3 rgb, float3x3 m) {
return mul(m, rgb) + float3(0, .5, .5);
}
float4 RGBAtoYUVA(float4 rgba, float3x3 m) {
return float4(RGBtoYUV(rgba.rgb, m), rgba.a);
}
float3 YUVtoRGB(float3 yuv, float3x3 m) {
return mul(m, yuv - float3(0, .5, .5));
}
float4 YUVAtoRGBA(float4 yuva, float3x3 m) {
return float4(YUVtoRGB(yuva.rgb, m), yuva.a);
}