[host] added format converter class

This commit is contained in:
Geoffrey McRae
2018-07-28 02:27:36 +10:00
parent 58c3b37e49
commit 2019766989
13 changed files with 6054 additions and 69 deletions

3163
host/Shaders/BGRAtoNV12.h Normal file

File diff suppressed because it is too large Load Diff

View 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

File diff suppressed because it is too large Load Diff

16
host/Shaders/Vertex.hlsl Normal file
View 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;
}