Render NV12 color format
This commit is contained in:
+22
-17
@@ -1,27 +1,32 @@
|
||||
//--------------------------------------------------------------------------------------
|
||||
// CombinedUVMipsPS.hlsl
|
||||
//--------------------------------------------------------------------------------------
|
||||
Texture2D txInputU : register(t0);
|
||||
Texture2D txInputV : register(t1);
|
||||
Texture1D txInputShift : register(t2);
|
||||
Texture2D image : register(t0);
|
||||
|
||||
SamplerState GenericSampler : register(s0);
|
||||
SamplerState def_sampler : register(s0);
|
||||
|
||||
struct PS_INPUT
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
float2 Tex : TEXCOORD;
|
||||
struct FragTexWide {
|
||||
float3 uuv : TEXCOORD0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Pixel Shader
|
||||
//--------------------------------------------------------------------------------------
|
||||
float PS(PS_INPUT input) : SV_Target
|
||||
float2 PS(FragTexWide input) : SV_Target
|
||||
{
|
||||
float fShift = (float)txInputShift.Sample(GenericSampler, input.Tex.x);
|
||||
// float4 color_vec_y = { 0.301f, 0.586f, 0.113f, 0.0f };
|
||||
// float4 color_vec_u = { -0.168f, -0.328f, 0.496f, 128.0f / 256.0f };
|
||||
// float4 color_vec_v = { 0.496f, 0.414f, 0.082f, 128.0f / 256.0f };
|
||||
float4 color_vec_y = { 0.299, 0.587, 0.114, 0.0625 };
|
||||
float4 color_vec_u = { -0.168736, -0.331264, 0.5, 0.5 };
|
||||
float4 color_vec_v = { 0.5, -0.418688, -0.081312, 0.5 };
|
||||
|
||||
if(fShift == 0.0f)
|
||||
return (float)txInputU.SampleLevel(GenericSampler, input.Tex, 1.0f);
|
||||
else
|
||||
return (float)txInputV.SampleLevel(GenericSampler, input.Tex, 1.0f);
|
||||
// float4 color_vec_y = { 0.2578f, 0.5039f, 0.0977, 0.0625 };
|
||||
// float4 color_vec_u = { -0.1484, 0.2891, 0.4375, 128.0f / 256.0f };
|
||||
// float4 color_vec_v = { 0.4375, -0.3672, -0.0703, 128.0f / 256.0f };
|
||||
|
||||
float3 rgb_left = image.Sample(def_sampler, input.uuv.xz).rgb;
|
||||
float3 rgb_right = image.Sample(def_sampler, input.uuv.yz).rgb;
|
||||
float3 rgb = (rgb_left + rgb_right) * 0.5;
|
||||
|
||||
float u = dot(color_vec_u.xyz, rgb) + color_vec_u.w;
|
||||
float v = dot(color_vec_v.xyz, rgb) + color_vec_v.w;
|
||||
return float2(u, v);
|
||||
}
|
||||
Reference in New Issue
Block a user