mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[host] added format converter class
This commit is contained in:
3163
host/Shaders/BGRAtoNV12.h
Normal file
3163
host/Shaders/BGRAtoNV12.h
Normal file
File diff suppressed because it is too large
Load Diff
26
host/Shaders/BGRAtoNV12.hlsl
Normal file
26
host/Shaders/BGRAtoNV12.hlsl
Normal file
@@ -0,0 +1,26 @@
|
||||
Texture2D texTexture;
|
||||
SamplerState texSampler;
|
||||
|
||||
struct VS
|
||||
{
|
||||
float4 pos : SV_Position;
|
||||
float2 tex : TEXCOORD;
|
||||
};
|
||||
|
||||
float4 RGBtoYUV(float4 rgba)
|
||||
{
|
||||
float4 yuva;
|
||||
yuva.r = rgba.r * 0.2126 + 0.7152 * rgba.g + 0.0722 * rgba.b;
|
||||
yuva.g = (rgba.b - yuva.r) / 1.8556;
|
||||
yuva.b = (rgba.r - yuva.r) / 1.5748;
|
||||
yuva.a = rgba.a;
|
||||
yuva.gb += 0.5;
|
||||
return yuva;
|
||||
}
|
||||
|
||||
float4 main(VS input) : SV_TARGET
|
||||
{
|
||||
const float4 rgba = texTexture.Sample(texSampler, input.tex);
|
||||
const float4 yuva = RGBtoYUV(rgba);
|
||||
return yuva;
|
||||
}
|
2232
host/Shaders/Vertex.h
Normal file
2232
host/Shaders/Vertex.h
Normal file
File diff suppressed because it is too large
Load Diff
16
host/Shaders/Vertex.hlsl
Normal file
16
host/Shaders/Vertex.hlsl
Normal file
@@ -0,0 +1,16 @@
|
||||
struct VS
|
||||
{
|
||||
float4 pos : POSITION;
|
||||
float2 tex : TEXCOORD;
|
||||
};
|
||||
|
||||
struct PS
|
||||
{
|
||||
float4 pos : SV_Position;
|
||||
float2 tex : TEXCOORD;
|
||||
};
|
||||
|
||||
PS main(VS input)
|
||||
{
|
||||
return input;
|
||||
}
|
Reference in New Issue
Block a user