New upstream version 23.2.1+dfsg1

This commit is contained in:
Simon Chopin 2019-07-27 14:47:10 +02:00
parent cdc9a9fc87
commit b14f9eae6d
1017 changed files with 37232 additions and 11111 deletions

64
libobs/data/area.effect Normal file
View file

@ -0,0 +1,64 @@
uniform float4x4 ViewProj;
uniform float2 base_dimension_i;
uniform texture2d image;
struct VertInOut {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertInOut VSDefault(VertInOut vert_in)
{
VertInOut vert_out;
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = vert_in.uv;
return vert_out;
}
float4 PSDrawAreaRGBA(VertInOut vert_in) : TARGET
{
float4 totalcolor = float4(0.0, 0.0, 0.0, 0.0);
float2 uv = vert_in.uv;
float2 uvdelta = float2(ddx(uv.x), ddy(uv.y));
// Handle potential OpenGL flip.
uvdelta.y = abs(uvdelta.y);
float2 uvhalfdelta = 0.5 * uvdelta;
float2 uvmin = uv - uvhalfdelta;
float2 uvmax = uv + uvhalfdelta;
int2 loadindexmin = int2(uvmin / base_dimension_i);
int2 loadindexmax = int2(uvmax / base_dimension_i);
float2 targetpos = uv / uvdelta;
float2 targetposmin = targetpos - 0.5;
float2 targetposmax = targetpos + 0.5;
float2 scale = base_dimension_i / uvdelta;
for (int loadindexy = loadindexmin.y; loadindexy <= loadindexmax.y; ++loadindexy)
{
for (int loadindexx = loadindexmin.x; loadindexx <= loadindexmax.x; ++loadindexx)
{
int2 loadindex = int2(loadindexx, loadindexy);
float2 potentialtargetmin = float2(loadindex) * scale;
float2 potentialtargetmax = potentialtargetmin + scale;
float2 targetmin = max(potentialtargetmin, targetposmin);
float2 targetmax = min(potentialtargetmax, targetposmax);
float area = (targetmax.x - targetmin.x) * (targetmax.y - targetmin.y);
float4 sample = image.Load(int3(loadindex, 0));
totalcolor += area * sample;
}
}
return totalcolor;
}
technique Draw
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawAreaRGBA(vert_in);
}
}

View file

@ -7,8 +7,6 @@
uniform float4x4 ViewProj;
uniform texture2d image;
uniform float4x4 color_matrix;
uniform float3 color_range_min = {0.0, 0.0, 0.0};
uniform float3 color_range_max = {1.0, 1.0, 1.0};
uniform float2 base_dimension_i;
uniform float undistort_factor = 1.0;
@ -132,13 +130,19 @@ float4 PSDrawBicubicRGBA(VertData v_in, bool undistort) : TARGET
return DrawBicubic(v_in, undistort);
}
float4 PSDrawBicubicMatrix(VertData v_in) : TARGET
float4 PSDrawBicubicRGBADivide(VertData v_in) : TARGET
{
float4 rgba = DrawBicubic(v_in, false);
float4 yuv;
float alpha = rgba.a;
float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0;
return float4(rgba.rgb * multiplier, alpha);
}
yuv.xyz = clamp(rgba.xyz, color_range_min, color_range_max);
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
float4 PSDrawBicubicMatrix(VertData v_in) : TARGET
{
float3 rgb = DrawBicubic(v_in, false).rgb;
float3 yuv = mul(float4(saturate(rgb), 1.0), color_matrix).xyz;
return float4(yuv, 1.0);
}
technique Draw
@ -150,6 +154,15 @@ technique Draw
}
}
technique DrawAlphaDivide
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSDrawBicubicRGBADivide(v_in);
}
}
technique DrawUndistort
{
pass

View file

@ -6,8 +6,6 @@
uniform float4x4 ViewProj;
uniform texture2d image;
uniform float4x4 color_matrix;
uniform float3 color_range_min = {0.0, 0.0, 0.0};
uniform float3 color_range_max = {1.0, 1.0, 1.0};
uniform float2 base_dimension_i;
sampler_state textureSampler {
@ -56,12 +54,19 @@ float4 PSDrawLowresBilinearRGBA(VertData v_in) : TARGET
return DrawLowresBilinear(v_in);
}
float4 PSDrawLowresBilinearRGBADivide(VertData v_in) : TARGET
{
float4 rgba = DrawLowresBilinear(v_in);
float alpha = rgba.a;
float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0;
return float4(rgba.rgb * multiplier, alpha);
}
float4 PSDrawLowresBilinearMatrix(VertData v_in) : TARGET
{
float4 yuv = DrawLowresBilinear(v_in);
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
float3 rgb = DrawLowresBilinear(v_in).rgb;
float3 yuv = mul(float4(saturate(rgb), 1.0), color_matrix).xyz;
return float4(yuv, 1.0);
}
technique Draw
@ -73,6 +78,15 @@ technique Draw
}
}
technique DrawAlphaDivide
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSDrawLowresBilinearRGBADivide(v_in);
}
}
technique DrawMatrix
{
pass

View file

@ -1,7 +1,5 @@
uniform float4x4 ViewProj;
uniform float4x4 color_matrix;
uniform float3 color_range_min = {0.0, 0.0, 0.0};
uniform float3 color_range_max = {1.0, 1.0, 1.0};
uniform texture2d image;
sampler_state def_sampler {
@ -28,11 +26,19 @@ float4 PSDrawBare(VertInOut vert_in) : TARGET
return image.Sample(def_sampler, vert_in.uv);
}
float4 PSDrawAlphaDivide(VertInOut vert_in) : TARGET
{
float4 rgba = image.Sample(def_sampler, vert_in.uv);
float alpha = rgba.a;
float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0;
return float4(rgba.rgb * multiplier, alpha);
}
float4 PSDrawMatrix(VertInOut vert_in) : TARGET
{
float4 yuv = image.Sample(def_sampler, vert_in.uv);
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max);
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb;
float3 yuv = mul(float4(rgb, 1.0), color_matrix).xyz;
return float4(yuv, 1.0);
}
technique Draw
@ -44,6 +50,15 @@ technique Draw
}
}
technique DrawAlphaDivide
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawAlphaDivide(vert_in);
}
}
technique DrawMatrix
{
pass

View file

@ -18,9 +18,6 @@
uniform float4x4 ViewProj;
uniform texture2d image;
uniform float4x4 color_matrix;
uniform float3 color_range_min = {0.0, 0.0, 0.0};
uniform float3 color_range_max = {1.0, 1.0, 1.0};
uniform texture2d previous_image;
uniform float2 dimensions;
@ -267,7 +264,7 @@ VertData VSDefault(VertData v_in)
return vert_out;
}
#define TECHNIQUE(rgba_ps, matrix_ps) \
#define TECHNIQUE(rgba_ps) \
technique Draw \
{ \
pass \
@ -275,19 +272,4 @@ technique Draw \
vertex_shader = VSDefault(v_in); \
pixel_shader = rgba_ps(v_in); \
} \
} \
float4 matrix_ps(VertData v_in) : TARGET \
{ \
float4 yuv = rgba_ps(v_in); \
yuv.xyz = clamp(yuv.xyz, color_range_min, color_range_max); \
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix)); \
} \
\
technique DrawMatrix \
{ \
pass \
{ \
vertex_shader = VSDefault(v_in); \
pixel_shader = matrix_ps(v_in); \
} \
}

View file

@ -18,4 +18,4 @@
#include "deinterlace_base.effect"
TECHNIQUE( PSBlendRGBA, PSBlendMatrix);
TECHNIQUE(PSBlendRGBA);

View file

@ -18,4 +18,4 @@
#include "deinterlace_base.effect"
TECHNIQUE(PSBlendRGBA_2x, PSBlendMatrix_2x);
TECHNIQUE(PSBlendRGBA_2x);

View file

@ -18,4 +18,4 @@
#include "deinterlace_base.effect"
TECHNIQUE(PSDiscardRGBA, PSDiscardMatrix);
TECHNIQUE(PSDiscardRGBA);

View file

@ -18,4 +18,4 @@
#include "deinterlace_base.effect"
TECHNIQUE(PSDiscardRGBA_2x, PSDiscardMatrix_2x);
TECHNIQUE(PSDiscardRGBA_2x);

View file

@ -18,4 +18,4 @@
#include "deinterlace_base.effect"
TECHNIQUE(PSLinearRGBA, PSLinearMatrix);
TECHNIQUE(PSLinearRGBA);

View file

@ -18,4 +18,4 @@
#include "deinterlace_base.effect"
TECHNIQUE(PSLinearRGBA_2x, PSLinearxMatrixA_2x);
TECHNIQUE(PSLinearRGBA_2x);

View file

@ -18,4 +18,4 @@
#include "deinterlace_base.effect"
TECHNIQUE(PSYadifMode0RGBA, PSYadifMode0Matrix);
TECHNIQUE(PSYadifMode0RGBA);

View file

@ -18,4 +18,4 @@
#include "deinterlace_base.effect"
TECHNIQUE(PSYadifMode0RGBA_2x, PSYadifMode0Matrix_2x);
TECHNIQUE(PSYadifMode0RGBA_2x);

View file

@ -42,6 +42,10 @@ uniform int int_input_width;
uniform int int_u_plane_offset;
uniform int int_v_plane_offset;
uniform float4x4 color_matrix;
uniform float3 color_range_min = {0.0, 0.0, 0.0};
uniform float3 color_range_max = {1.0, 1.0, 1.0};
uniform texture2d image;
sampler_state def_sampler {
@ -126,6 +130,16 @@ float4 PSNV12(VertInOut vert_in) : TARGET
}
}
float PSNV12_Y(VertInOut vert_in) : TARGET
{
return image.Sample(def_sampler, vert_in.uv.xy).y;
}
float2 PSNV12_UV(VertInOut vert_in) : TARGET
{
return image.Sample(def_sampler, vert_in.uv.xy).xz;
}
float4 PSPlanar420(VertInOut vert_in) : TARGET
{
float v_mul = floor(vert_in.uv.y * input_height);
@ -273,8 +287,10 @@ float4 PSPacked422_Reverse(VertInOut vert_in, int u_pos, int v_pos,
x += input_width_i_d2;
float4 texel = image.Sample(def_sampler, float2(x, y));
return float4(odd > 0.5 ? texel[y1_pos] : texel[y0_pos],
texel[u_pos], texel[v_pos], 1.0);
float3 yuv = float3(odd > 0.5 ? texel[y1_pos] : texel[y0_pos],
texel[u_pos], texel[v_pos]);
yuv = clamp(yuv, color_range_min, color_range_max);
return saturate(mul(float4(yuv, 1.0), color_matrix));
}
float4 PSPlanar420_Reverse(VertInOut vert_in) : TARGET
@ -287,12 +303,32 @@ float4 PSPlanar420_Reverse(VertInOut vert_in) : TARGET
int chroma1 = int_u_plane_offset + chroma_offset;
int chroma2 = int_v_plane_offset + chroma_offset;
return float4(
float3 yuv = float3(
GetIntOffsetColor(lum_offset),
GetIntOffsetColor(chroma1),
GetIntOffsetColor(chroma2),
1.0
GetIntOffsetColor(chroma2)
);
yuv = clamp(yuv, color_range_min, color_range_max);
return saturate(mul(float4(yuv, 1.0), color_matrix));
}
float4 PSPlanar444_Reverse(VertInOut vert_in) : TARGET
{
int x = int(vert_in.uv.x * width + PRECISION_OFFSET);
int y = int(vert_in.uv.y * height + PRECISION_OFFSET);
int lum_offset = y * int_width + x;
int chroma_offset = y * int_width + x;
int chroma1 = int_u_plane_offset + chroma_offset;
int chroma2 = int_v_plane_offset + chroma_offset;
float3 yuv = float3(
GetIntOffsetColor(lum_offset),
GetIntOffsetColor(chroma1),
GetIntOffsetColor(chroma2)
);
yuv = clamp(yuv, color_range_min, color_range_max);
return saturate(mul(float4(yuv, 1.0), color_matrix));
}
float4 PSNV12_Reverse(VertInOut vert_in) : TARGET
@ -304,12 +340,42 @@ float4 PSNV12_Reverse(VertInOut vert_in) : TARGET
int chroma_offset = (y / 2) * (int_width / 2) + x / 2;
int chroma = int_u_plane_offset + chroma_offset * 2;
return float4(
float3 yuv = float3(
GetIntOffsetColor(lum_offset),
GetIntOffsetColor(chroma),
GetIntOffsetColor(chroma + 1),
1.0
GetIntOffsetColor(chroma + 1)
);
yuv = clamp(yuv, color_range_min, color_range_max);
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
@ -339,6 +405,24 @@ technique NV12
}
}
technique NV12_Y
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSNV12_Y(vert_in);
}
}
technique NV12_UV
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSNV12_UV(vert_in);
}
}
technique UYVY_Reverse
{
pass
@ -375,6 +459,15 @@ technique I420_Reverse
}
}
technique I444_Reverse
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSPlanar444_Reverse(vert_in);
}
}
technique NV12_Reverse
{
pass
@ -383,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);
}
}

View file

@ -7,8 +7,6 @@
uniform float4x4 ViewProj;
uniform texture2d image;
uniform float4x4 color_matrix;
uniform float3 color_range_min = {0.0, 0.0, 0.0};
uniform float3 color_range_max = {1.0, 1.0, 1.0};
uniform float2 base_dimension_i;
uniform float undistort_factor = 1.0;
@ -140,13 +138,19 @@ float4 PSDrawLanczosRGBA(FragData v_in, bool undistort) : TARGET
return DrawLanczos(v_in, undistort);
}
float4 PSDrawLanczosMatrix(FragData v_in) : TARGET
float4 PSDrawLanczosRGBADivide(FragData v_in) : TARGET
{
float4 rgba = DrawLanczos(v_in, false);
float4 yuv;
float alpha = rgba.a;
float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0;
return float4(rgba.rgb * multiplier, alpha);
}
yuv.xyz = clamp(rgba.xyz, color_range_min, color_range_max);
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
float4 PSDrawLanczosMatrix(FragData v_in) : TARGET
{
float3 rgb = DrawLanczos(v_in, false).rgb;
float3 yuv = mul(float4(saturate(rgb), 1.0), color_matrix).xyz;
return float4(yuv, 1.0);
}
technique Draw
@ -158,6 +162,15 @@ technique Draw
}
}
technique DrawAlphaDivide
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSDrawLanczosRGBADivide(v_in);
}
}
technique DrawUndistort
{
pass

36
libobs/data/repeat.effect Normal file
View file

@ -0,0 +1,36 @@
uniform float4x4 ViewProj;
uniform texture2d image;
uniform float2 scale;
sampler_state def_sampler {
Filter = Linear;
AddressU = Repeat;
AddressV = Repeat;
};
struct VertInOut {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertInOut VSDefault(VertInOut vert_in)
{
VertInOut vert_out;
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = vert_in.uv * scale;
return vert_out;
}
float4 PSDrawBare(VertInOut vert_in) : TARGET
{
return image.Sample(def_sampler, vert_in.uv);
}
technique Draw
{
pass
{
vertex_shader = VSDefault(vert_in);
pixel_shader = PSDrawBare(vert_in);
}
}