libobs: Support limited color range for RGB/Y800 sources

libobs: Add support for limited to full color range conversions when
using RGB or Y800 formats, and move RGB converison for Y800 formats to
the GPU.

decklink: Stop hiding color space/range properties for RGB formats, and
remove "YUV" from "YUV Color Space" and "YUV Color Range".

win-dshow: Remove "YUV" from "YUV Color Space" and "YUV Color Range".

UI: Remove "YUV" from "YUV Color Space" and "YUV Color Range".
This commit is contained in:
James Park
2019-04-22 23:38:26 -07:00
committed by jp9000
parent 7d136c3ce1
commit a86710ec5b
7 changed files with 133 additions and 100 deletions

View File

@@ -349,6 +349,35 @@ float4 PSNV12_Reverse(VertInOut vert_in) : TARGET
return saturate(mul(float4(yuv, 1.0), color_matrix));
}
float4 PSY800_Limited(VertInOut vert_in) : TARGET
{
int x = int(vert_in.uv.x * width + PRECISION_OFFSET);
int y = int(vert_in.uv.y * height + PRECISION_OFFSET);
float limited = image.Load(int3(x, y, 0)).x;
float full = saturate((limited - (16.0 / 255.0)) * (255.0 / 219.0));
return float4(full, full, full, 1.0);
}
float4 PSY800_Full(VertInOut vert_in) : TARGET
{
int x = int(vert_in.uv.x * width + PRECISION_OFFSET);
int y = int(vert_in.uv.y * height + PRECISION_OFFSET);
float3 full = image.Load(int3(x, y, 0)).xxx;
return float4(full, 1.0);
}
float4 PSRGB_Limited(VertInOut vert_in) : TARGET
{
int x = int(vert_in.uv.x * width + PRECISION_OFFSET);
int y = int(vert_in.uv.y * height + PRECISION_OFFSET);
float4 rgba = image.Load(int3(x, y, 0));
rgba.rgb = saturate((rgba.rgb - (16.0 / 255.0)) * (255.0 / 219.0));
return rgba;
}
technique Planar420
{
pass
@@ -447,3 +476,30 @@ technique NV12_Reverse
pixel_shader = PSNV12_Reverse(vert_in);
}
}
technique Y800_Limited
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSY800_Limited(vert_in);
}
}
technique Y800_Full
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSY800_Full(vert_in);
}
}
technique RGB_Limited
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSRGB_Limited(vert_in);
}
}