mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-13 12:51:16 +00:00
d3d12: Add A420, A422 and A444 format support
Adding A420/A422/A444 and its 10/12/16 bits format support Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7093>
This commit is contained in:
parent
52bc28c93d
commit
bb0f95a67f
4 changed files with 388 additions and 10 deletions
|
@ -49,6 +49,8 @@
|
|||
/* both SRV and RTV are supported */
|
||||
#define GST_D3D12_TIER_1_FORMATS \
|
||||
"AYUV64, GBRA_12LE, GBRA_10LE, AYUV, ABGR, ARGB, GBRA, Y444_16LE, " \
|
||||
"A444_16LE, A444_12LE, A444_10LE, A444, " \
|
||||
"A422_16LE, A422_12LE, A422_10LE, A422, A420_16LE, A420_12LE, A420_10LE, A420, " \
|
||||
"GBR_16LE, Y444_12LE, GBR_12LE, I422_12LE, I420_12LE, Y444_10LE, GBR_10LE, " \
|
||||
"I422_10LE, I420_10LE, Y444, BGRP, GBR, RGBP, xBGR, xRGB, Y42B, NV21, " \
|
||||
"I420, YV12, Y41B, YUV9, YVU9, GRAY16_LE, GRAY8"
|
||||
|
|
|
@ -1197,7 +1197,8 @@ gst_d3d12_converter_update_dest_rect (GstD3D12Converter * self)
|
|||
|
||||
gst_d3d12_converter_update_clear_background (self);
|
||||
|
||||
switch (GST_VIDEO_INFO_FORMAT (&priv->out_info)) {
|
||||
auto format = GST_VIDEO_INFO_FORMAT (&priv->out_info);
|
||||
switch (format) {
|
||||
case GST_VIDEO_FORMAT_YUV9:
|
||||
case GST_VIDEO_FORMAT_YVU9:
|
||||
priv->viewport[1].TopLeftX = priv->viewport[0].TopLeftX / 4;
|
||||
|
@ -1238,6 +1239,10 @@ gst_d3d12_converter_update_dest_rect (GstD3D12Converter * self)
|
|||
case GST_VIDEO_FORMAT_YV12:
|
||||
case GST_VIDEO_FORMAT_I420_10LE:
|
||||
case GST_VIDEO_FORMAT_I420_12LE:
|
||||
case GST_VIDEO_FORMAT_A420:
|
||||
case GST_VIDEO_FORMAT_A420_10LE:
|
||||
case GST_VIDEO_FORMAT_A420_12LE:
|
||||
case GST_VIDEO_FORMAT_A420_16LE:
|
||||
priv->viewport[1].TopLeftX = priv->viewport[0].TopLeftX / 2;
|
||||
priv->viewport[1].TopLeftY = priv->viewport[0].TopLeftY / 2;
|
||||
priv->viewport[1].Width = priv->viewport[0].Width / 2;
|
||||
|
@ -1256,6 +1261,10 @@ gst_d3d12_converter_update_dest_rect (GstD3D12Converter * self)
|
|||
case GST_VIDEO_FORMAT_Y42B:
|
||||
case GST_VIDEO_FORMAT_I422_10LE:
|
||||
case GST_VIDEO_FORMAT_I422_12LE:
|
||||
case GST_VIDEO_FORMAT_A422:
|
||||
case GST_VIDEO_FORMAT_A422_10LE:
|
||||
case GST_VIDEO_FORMAT_A422_12LE:
|
||||
case GST_VIDEO_FORMAT_A422_16LE:
|
||||
priv->viewport[1].TopLeftX = priv->viewport[0].TopLeftX / 2;
|
||||
priv->viewport[1].TopLeftY = priv->viewport[0].TopLeftY;
|
||||
priv->viewport[1].Width = priv->viewport[0].Width / 2;
|
||||
|
@ -1284,6 +1293,10 @@ gst_d3d12_converter_update_dest_rect (GstD3D12Converter * self)
|
|||
case GST_VIDEO_FORMAT_GBRA:
|
||||
case GST_VIDEO_FORMAT_GBRA_10LE:
|
||||
case GST_VIDEO_FORMAT_GBRA_12LE:
|
||||
case GST_VIDEO_FORMAT_A444:
|
||||
case GST_VIDEO_FORMAT_A444_10LE:
|
||||
case GST_VIDEO_FORMAT_A444_12LE:
|
||||
case GST_VIDEO_FORMAT_A444_16LE:
|
||||
for (guint i = 1; i < GST_VIDEO_INFO_N_PLANES (&priv->out_info); i++) {
|
||||
priv->viewport[i] = priv->viewport[0];
|
||||
priv->scissor_rect[i] = priv->scissor_rect[0];
|
||||
|
@ -1513,6 +1526,9 @@ gst_d3d12_converter_calculate_border_color (GstD3D12Converter * self)
|
|||
case GST_VIDEO_FORMAT_Y444_10LE:
|
||||
case GST_VIDEO_FORMAT_GBR_10LE:
|
||||
case GST_VIDEO_FORMAT_GBRA_10LE:
|
||||
case GST_VIDEO_FORMAT_A420_10LE:
|
||||
case GST_VIDEO_FORMAT_A422_10LE:
|
||||
case GST_VIDEO_FORMAT_A444_10LE:
|
||||
for (guint i = 0; i < 3; i++) {
|
||||
converted[i] /= 64.0;
|
||||
}
|
||||
|
@ -1523,6 +1539,9 @@ gst_d3d12_converter_calculate_border_color (GstD3D12Converter * self)
|
|||
case GST_VIDEO_FORMAT_Y444_12LE:
|
||||
case GST_VIDEO_FORMAT_GBR_12LE:
|
||||
case GST_VIDEO_FORMAT_GBRA_12LE:
|
||||
case GST_VIDEO_FORMAT_A420_12LE:
|
||||
case GST_VIDEO_FORMAT_A422_12LE:
|
||||
case GST_VIDEO_FORMAT_A444_12LE:
|
||||
for (guint i = 0; i < 3; i++) {
|
||||
converted[i] /= 16.0;
|
||||
}
|
||||
|
@ -1624,6 +1643,23 @@ gst_d3d12_converter_calculate_border_color (GstD3D12Converter * self)
|
|||
priv->clear_color[2][2] = 0;
|
||||
priv->clear_color[2][3] = 1.0;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_A420:
|
||||
case GST_VIDEO_FORMAT_A420_10LE:
|
||||
case GST_VIDEO_FORMAT_A420_12LE:
|
||||
case GST_VIDEO_FORMAT_A420_16LE:
|
||||
case GST_VIDEO_FORMAT_A422:
|
||||
case GST_VIDEO_FORMAT_A422_10LE:
|
||||
case GST_VIDEO_FORMAT_A422_12LE:
|
||||
case GST_VIDEO_FORMAT_A422_16LE:
|
||||
case GST_VIDEO_FORMAT_A444:
|
||||
case GST_VIDEO_FORMAT_A444_10LE:
|
||||
case GST_VIDEO_FORMAT_A444_12LE:
|
||||
case GST_VIDEO_FORMAT_A444_16LE:
|
||||
priv->clear_color[0][0] = converted[0];
|
||||
priv->clear_color[1][0] = converted[1];
|
||||
priv->clear_color[2][0] = converted[2];
|
||||
priv->clear_color[3][0] = a;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_RGBP:
|
||||
priv->clear_color[0][0] = converted[0];
|
||||
priv->clear_color[1][0] = converted[1];
|
||||
|
@ -1917,6 +1953,32 @@ gst_d3d12_converter_update_pso (GstD3D12Converter * self)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
reorder_rtv_handles (GstVideoFormat output_format,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE * src, D3D12_CPU_DESCRIPTOR_HANDLE * dst)
|
||||
{
|
||||
switch (output_format) {
|
||||
case GST_VIDEO_FORMAT_A420:
|
||||
case GST_VIDEO_FORMAT_A420_10LE:
|
||||
case GST_VIDEO_FORMAT_A420_12LE:
|
||||
case GST_VIDEO_FORMAT_A420_16LE:
|
||||
case GST_VIDEO_FORMAT_A422:
|
||||
case GST_VIDEO_FORMAT_A422_10LE:
|
||||
case GST_VIDEO_FORMAT_A422_12LE:
|
||||
case GST_VIDEO_FORMAT_A422_16LE:
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[3];
|
||||
dst[2] = src[1];
|
||||
dst[3] = src[2];
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (guint i = 0; i < GST_VIDEO_MAX_PLANES; i++)
|
||||
dst[i] = src[i];
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_d3d12_converter_execute (GstD3D12Converter * self, GstD3D12Frame * in_frame,
|
||||
GstD3D12Frame * out_frame, GstD3D12FenceData * fence_data,
|
||||
|
@ -2014,6 +2076,10 @@ gst_d3d12_converter_execute (GstD3D12Converter * self, GstD3D12Frame * in_frame,
|
|||
}
|
||||
}
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE reordered_rtv_handle[GST_VIDEO_MAX_PLANES];
|
||||
reorder_rtv_handles (GST_VIDEO_INFO_FORMAT (&priv->out_info),
|
||||
out_frame->rtv_desc_handle, reordered_rtv_handle);
|
||||
|
||||
auto pso = priv->quad_data[0].pso.Get ();
|
||||
|
||||
cl->SetGraphicsRootSignature (priv->rs.Get ());
|
||||
|
@ -2033,10 +2099,10 @@ gst_d3d12_converter_execute (GstD3D12Converter * self, GstD3D12Frame * in_frame,
|
|||
cl->IASetIndexBuffer (&priv->idv);
|
||||
cl->IASetVertexBuffers (0, 1, &priv->vbv);
|
||||
cl->IASetPrimitiveTopology (D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
cl->RSSetViewports (priv->quad_data[0].num_rtv, priv->viewport);
|
||||
cl->RSSetScissorRects (priv->quad_data[0].num_rtv, priv->scissor_rect);
|
||||
cl->RSSetViewports (1, priv->viewport);
|
||||
cl->RSSetScissorRects (1, priv->scissor_rect);
|
||||
cl->OMSetRenderTargets (priv->quad_data[0].num_rtv,
|
||||
out_frame->rtv_desc_handle, FALSE, nullptr);
|
||||
reordered_rtv_handle, FALSE, nullptr);
|
||||
cl->OMSetBlendFactor (priv->blend_factor);
|
||||
cl->DrawIndexedInstanced (6, 1, 0, 0, 0);
|
||||
|
||||
|
@ -2048,11 +2114,10 @@ gst_d3d12_converter_execute (GstD3D12Converter * self, GstD3D12Frame * in_frame,
|
|||
pso = priv->quad_data[1].pso.Get ();
|
||||
|
||||
cl->SetPipelineState (pso);
|
||||
cl->RSSetViewports (priv->quad_data[1].num_rtv, &priv->viewport[offset]);
|
||||
cl->RSSetScissorRects (priv->quad_data[1].num_rtv,
|
||||
&priv->scissor_rect[offset]);
|
||||
cl->RSSetViewports (1, &priv->viewport[offset]);
|
||||
cl->RSSetScissorRects (1, &priv->scissor_rect[offset]);
|
||||
cl->OMSetRenderTargets (priv->quad_data[1].num_rtv,
|
||||
out_frame->rtv_desc_handle + offset, FALSE, nullptr);
|
||||
reordered_rtv_handle + offset, FALSE, nullptr);
|
||||
cl->DrawIndexedInstanced (6, 1, 0, 0, 0);
|
||||
|
||||
pso->AddRef ();
|
||||
|
|
|
@ -73,6 +73,12 @@ struct PS_OUTPUT_CHROMA_PLANAR
|
|||
float4 Plane1: SV_TARGET1;
|
||||
};
|
||||
|
||||
struct PS_OUTPUT_LUMA_ALPHA
|
||||
{
|
||||
float4 Plane0: SV_TARGET0;
|
||||
float4 Plane1: SV_TARGET1;
|
||||
};
|
||||
|
||||
struct PS_OUTPUT_PLANAR
|
||||
{
|
||||
float4 Plane0: SV_TARGET0;
|
||||
|
@ -206,6 +212,45 @@ class SamplerI420_12 : ISampler
|
|||
}
|
||||
};
|
||||
|
||||
class SamplerA420 : ISampler
|
||||
{
|
||||
float4 Execute (float2 uv)
|
||||
{
|
||||
float4 sample;
|
||||
sample.x = shaderTexture_0.Sample(samplerState, uv).x;
|
||||
sample.y = shaderTexture_1.Sample(samplerState, uv).x;
|
||||
sample.z = shaderTexture_2.Sample(samplerState, uv).x;
|
||||
sample.a = shaderTexture_3.Sample(samplerState, uv).x;
|
||||
return sample;
|
||||
}
|
||||
};
|
||||
|
||||
class SamplerA420_10 : ISampler
|
||||
{
|
||||
float4 Execute (float2 uv)
|
||||
{
|
||||
float4 sample;
|
||||
sample.x = shaderTexture_0.Sample(samplerState, uv).x;
|
||||
sample.y = shaderTexture_1.Sample(samplerState, uv).x;
|
||||
sample.z = shaderTexture_2.Sample(samplerState, uv).x;
|
||||
sample.a = shaderTexture_3.Sample(samplerState, uv).x;
|
||||
return float4 (saturate (sample * 64.0));
|
||||
}
|
||||
};
|
||||
|
||||
class SamplerA420_12 : ISampler
|
||||
{
|
||||
float4 Execute (float2 uv)
|
||||
{
|
||||
float4 sample;
|
||||
sample.x = shaderTexture_0.Sample(samplerState, uv).x;
|
||||
sample.y = shaderTexture_1.Sample(samplerState, uv).x;
|
||||
sample.z = shaderTexture_2.Sample(samplerState, uv).x;
|
||||
sample.a = shaderTexture_3.Sample(samplerState, uv).x;
|
||||
return float4 (saturate (sample * 16.0));
|
||||
}
|
||||
};
|
||||
|
||||
class SamplerVUYA : ISampler
|
||||
{
|
||||
float4 Execute (float2 uv)
|
||||
|
@ -749,7 +794,8 @@ class OutputChromaNV21 : IOutputChroma
|
|||
};
|
||||
|
||||
interface IOutputChromaPlanar
|
||||
{ PS_OUTPUT_CHROMA_PLANAR Build (float4 sample);
|
||||
{
|
||||
PS_OUTPUT_CHROMA_PLANAR Build (float4 sample);
|
||||
};
|
||||
|
||||
class OutputChromaI420 : IOutputChromaPlanar
|
||||
|
@ -798,6 +844,48 @@ class OutputChromaI420_12 : IOutputChromaPlanar
|
|||
}
|
||||
};
|
||||
|
||||
interface IOutputLumaAlpha
|
||||
{
|
||||
PS_OUTPUT_LUMA_ALPHA Build (float4 sample);
|
||||
};
|
||||
|
||||
class OutputLumaAlphaA420 : IOutputLumaAlpha
|
||||
{
|
||||
PS_OUTPUT_LUMA_ALPHA Build (float4 sample)
|
||||
{
|
||||
PS_OUTPUT_LUMA_ALPHA output;
|
||||
output.Plane0 = float4 (sample.x, 0, 0, 0);
|
||||
output.Plane1 = float4 (sample.a * alphaFactor, 0, 0, 0);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
class OutputLumaAlphaA420_10 : IOutputLumaAlpha
|
||||
{
|
||||
PS_OUTPUT_LUMA_ALPHA Build (float4 sample)
|
||||
{
|
||||
PS_OUTPUT_LUMA_ALPHA output;
|
||||
sample.a *= alphaFactor;
|
||||
float2 scaled = UnormTo10bit (sample.xw);
|
||||
output.Plane0 = float4 (scaled.x, 0, 0, 0);
|
||||
output.Plane1 = float4 (scaled.y, 0, 0, 0);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
class OutputLumaAlphaA420_12 : IOutputLumaAlpha
|
||||
{
|
||||
PS_OUTPUT_LUMA_ALPHA Build (float4 sample)
|
||||
{
|
||||
PS_OUTPUT_LUMA_ALPHA output;
|
||||
sample.a *= alphaFactor;
|
||||
float2 scaled = UnormTo12bit (sample.xw);
|
||||
output.Plane0 = float4 (scaled.x, 0, 0, 0);
|
||||
output.Plane1 = float4 (scaled.y, 0, 0, 0);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
interface IOutputPlanar
|
||||
{
|
||||
PS_OUTPUT_PLANAR Build (float4 sample);
|
||||
|
@ -1001,6 +1089,51 @@ class OutputGBRAPremul_12 : IOutputPlanarFull
|
|||
}
|
||||
};
|
||||
|
||||
class OutputA444 : IOutputPlanarFull
|
||||
{
|
||||
PS_OUTPUT_PLANAR_FULL Build (float4 sample)
|
||||
{
|
||||
PS_OUTPUT_PLANAR_FULL output;
|
||||
output.Plane0 = float4 (sample.x, 0, 0, 0);
|
||||
output.Plane1 = float4 (sample.y, 0, 0, 0);
|
||||
output.Plane2 = float4 (sample.z, 0, 0, 0);
|
||||
output.Plane3 = float4 (sample.a * alphaFactor, 0, 0, 0);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
class OutputA444_10 : IOutputPlanarFull
|
||||
{
|
||||
PS_OUTPUT_PLANAR_FULL Build (float4 sample)
|
||||
{
|
||||
PS_OUTPUT_PLANAR_FULL output;
|
||||
float4 scaled;
|
||||
sample.a *= alphaFactor;
|
||||
scaled = UnormTo10bit (sample);
|
||||
output.Plane0 = float4 (scaled.x, 0, 0, 0);
|
||||
output.Plane1 = float4 (scaled.y, 0, 0, 0);
|
||||
output.Plane2 = float4 (scaled.z, 0, 0, 0);
|
||||
output.Plane3 = float4 (scaled.a, 0, 0, 0);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
class OutputA444_12 : IOutputPlanarFull
|
||||
{
|
||||
PS_OUTPUT_PLANAR_FULL Build (float4 sample)
|
||||
{
|
||||
PS_OUTPUT_PLANAR_FULL output;
|
||||
float4 scaled;
|
||||
sample.a *= alphaFactor;
|
||||
scaled = UnormTo12bit (sample);
|
||||
output.Plane0 = float4 (scaled.x, 0, 0, 0);
|
||||
output.Plane1 = float4 (scaled.y, 0, 0, 0);
|
||||
output.Plane2 = float4 (scaled.z, 0, 0, 0);
|
||||
output.Plane3 = float4 (scaled.a, 0, 0, 0);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
interface IOutputPacked
|
||||
{
|
||||
PS_OUTPUT_PACKED Build (float4 sample);
|
||||
|
@ -1267,6 +1400,12 @@ static const char str_PSMain_converter[] =
|
|||
" float4 Plane1: SV_TARGET1;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"struct PS_OUTPUT_LUMA_ALPHA\n"
|
||||
"{\n"
|
||||
" float4 Plane0: SV_TARGET0;\n"
|
||||
" float4 Plane1: SV_TARGET1;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"struct PS_OUTPUT_PLANAR\n"
|
||||
"{\n"
|
||||
" float4 Plane0: SV_TARGET0;\n"
|
||||
|
@ -1400,6 +1539,45 @@ static const char str_PSMain_converter[] =
|
|||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class SamplerA420 : ISampler\n"
|
||||
"{\n"
|
||||
" float4 Execute (float2 uv)\n"
|
||||
" {\n"
|
||||
" float4 sample;\n"
|
||||
" sample.x = shaderTexture_0.Sample(samplerState, uv).x;\n"
|
||||
" sample.y = shaderTexture_1.Sample(samplerState, uv).x;\n"
|
||||
" sample.z = shaderTexture_2.Sample(samplerState, uv).x;\n"
|
||||
" sample.a = shaderTexture_3.Sample(samplerState, uv).x;\n"
|
||||
" return sample;\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class SamplerA420_10 : ISampler\n"
|
||||
"{\n"
|
||||
" float4 Execute (float2 uv)\n"
|
||||
" {\n"
|
||||
" float4 sample;\n"
|
||||
" sample.x = shaderTexture_0.Sample(samplerState, uv).x;\n"
|
||||
" sample.y = shaderTexture_1.Sample(samplerState, uv).x;\n"
|
||||
" sample.z = shaderTexture_2.Sample(samplerState, uv).x;\n"
|
||||
" sample.a = shaderTexture_3.Sample(samplerState, uv).x;\n"
|
||||
" return float4 (saturate (sample * 64.0));\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class SamplerA420_12 : ISampler\n"
|
||||
"{\n"
|
||||
" float4 Execute (float2 uv)\n"
|
||||
" {\n"
|
||||
" float4 sample;\n"
|
||||
" sample.x = shaderTexture_0.Sample(samplerState, uv).x;\n"
|
||||
" sample.y = shaderTexture_1.Sample(samplerState, uv).x;\n"
|
||||
" sample.z = shaderTexture_2.Sample(samplerState, uv).x;\n"
|
||||
" sample.a = shaderTexture_3.Sample(samplerState, uv).x;\n"
|
||||
" return float4 (saturate (sample * 16.0));\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class SamplerVUYA : ISampler\n"
|
||||
"{\n"
|
||||
" float4 Execute (float2 uv)\n"
|
||||
|
@ -1943,7 +2121,8 @@ static const char str_PSMain_converter[] =
|
|||
"};\n"
|
||||
"\n"
|
||||
"interface IOutputChromaPlanar\n"
|
||||
"{ PS_OUTPUT_CHROMA_PLANAR Build (float4 sample);\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_CHROMA_PLANAR Build (float4 sample);\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class OutputChromaI420 : IOutputChromaPlanar\n"
|
||||
|
@ -1992,6 +2171,47 @@ static const char str_PSMain_converter[] =
|
|||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"interface IOutputLumaAlpha\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_LUMA_ALPHA Build (float4 sample);\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class OutputLumaAlphaA420 : IOutputLumaAlpha\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_LUMA_ALPHA Build (float4 sample)\n"
|
||||
" {\n"
|
||||
" PS_OUTPUT_LUMA_ALPHA output;\n"
|
||||
" output.Plane0 = float4 (sample.x, 0, 0, 0);\n"
|
||||
" output.Plane1 = float4 (sample.a * alphaFactor, 0, 0, 0);\n"
|
||||
" return output;\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class OutputLumaAlphaA420_10 : IOutputLumaAlpha\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_LUMA_ALPHA Build (float4 sample)\n"
|
||||
" {\n"
|
||||
" PS_OUTPUT_LUMA_ALPHA output;\n"
|
||||
" sample.a *= alphaFactor;\n"
|
||||
" float2 scaled = UnormTo10bit (sample.xw);\n"
|
||||
" output.Plane0 = float4 (scaled.x, 0, 0, 0);\n"
|
||||
" output.Plane1 = float4 (scaled.y, 0, 0, 0);\n"
|
||||
" return output;\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class OutputLumaAlphaA420_12 : IOutputLumaAlpha\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_LUMA_ALPHA Build (float4 sample)\n"
|
||||
" {\n"
|
||||
" PS_OUTPUT_LUMA_ALPHA output;\n"
|
||||
" sample.a *= alphaFactor;\n"
|
||||
" float2 scaled = UnormTo12bit (sample.xw);\n"
|
||||
" output.Plane0 = float4 (scaled.x, 0, 0, 0);\n"
|
||||
" output.Plane1 = float4 (scaled.y, 0, 0, 0);\n"
|
||||
" return output;\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
"interface IOutputPlanar\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_PLANAR Build (float4 sample);\n"
|
||||
|
@ -2195,6 +2415,51 @@ static const char str_PSMain_converter[] =
|
|||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class OutputA444 : IOutputPlanarFull\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_PLANAR_FULL Build (float4 sample)\n"
|
||||
" {\n"
|
||||
" PS_OUTPUT_PLANAR_FULL output;\n"
|
||||
" output.Plane0 = float4 (sample.x, 0, 0, 0);\n"
|
||||
" output.Plane1 = float4 (sample.y, 0, 0, 0);\n"
|
||||
" output.Plane2 = float4 (sample.z, 0, 0, 0);\n"
|
||||
" output.Plane3 = float4 (sample.a * alphaFactor, 0, 0, 0);\n"
|
||||
" return output;\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class OutputA444_10 : IOutputPlanarFull\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_PLANAR_FULL Build (float4 sample)\n"
|
||||
" {\n"
|
||||
" PS_OUTPUT_PLANAR_FULL output;\n"
|
||||
" float4 scaled;\n"
|
||||
" sample.a *= alphaFactor;\n"
|
||||
" scaled = UnormTo10bit (sample);\n"
|
||||
" output.Plane0 = float4 (scaled.x, 0, 0, 0);\n"
|
||||
" output.Plane1 = float4 (scaled.y, 0, 0, 0);\n"
|
||||
" output.Plane2 = float4 (scaled.z, 0, 0, 0);\n"
|
||||
" output.Plane3 = float4 (scaled.a, 0, 0, 0);\n"
|
||||
" return output;\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"class OutputA444_12 : IOutputPlanarFull\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_PLANAR_FULL Build (float4 sample)\n"
|
||||
" {\n"
|
||||
" PS_OUTPUT_PLANAR_FULL output;\n"
|
||||
" float4 scaled;\n"
|
||||
" sample.a *= alphaFactor;\n"
|
||||
" scaled = UnormTo12bit (sample);\n"
|
||||
" output.Plane0 = float4 (scaled.x, 0, 0, 0);\n"
|
||||
" output.Plane1 = float4 (scaled.y, 0, 0, 0);\n"
|
||||
" output.Plane2 = float4 (scaled.z, 0, 0, 0);\n"
|
||||
" output.Plane3 = float4 (scaled.a, 0, 0, 0);\n"
|
||||
" return output;\n"
|
||||
" }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"interface IOutputPacked\n"
|
||||
"{\n"
|
||||
" PS_OUTPUT_PACKED Build (float4 sample);\n"
|
||||
|
|
|
@ -560,6 +560,7 @@ enum class PS_OUTPUT
|
|||
LUMA,
|
||||
CHROMA,
|
||||
CHROMA_PLANAR,
|
||||
LUMA_ALPHA,
|
||||
PLANAR,
|
||||
PLANAR_FULL,
|
||||
};
|
||||
|
@ -576,6 +577,8 @@ ps_output_to_string (PS_OUTPUT output)
|
|||
return "PS_OUTPUT_CHROMA";
|
||||
case PS_OUTPUT::CHROMA_PLANAR:
|
||||
return "PS_OUTPUT_CHROMA_PLANAR";
|
||||
case PS_OUTPUT::LUMA_ALPHA:
|
||||
return "PS_OUTPUT_LUMA_ALPHA";
|
||||
case PS_OUTPUT::PLANAR:
|
||||
return "PS_OUTPUT_PLANAR";
|
||||
case PS_OUTPUT::PLANAR_FULL:
|
||||
|
@ -597,6 +600,7 @@ ps_output_get_num_rtv (PS_OUTPUT output)
|
|||
case PS_OUTPUT::CHROMA:
|
||||
return 1;
|
||||
case PS_OUTPUT::CHROMA_PLANAR:
|
||||
case PS_OUTPUT::LUMA_ALPHA:
|
||||
return 2;
|
||||
case PS_OUTPUT::PLANAR:
|
||||
return 3;
|
||||
|
@ -719,6 +723,21 @@ conv_ps_make_input (GstVideoFormat format, gboolean premul)
|
|||
return "RGB15";
|
||||
case GST_VIDEO_FORMAT_BGR15:
|
||||
return "BGR15";
|
||||
case GST_VIDEO_FORMAT_A420:
|
||||
case GST_VIDEO_FORMAT_A420_16LE:
|
||||
case GST_VIDEO_FORMAT_A422:
|
||||
case GST_VIDEO_FORMAT_A422_16LE:
|
||||
case GST_VIDEO_FORMAT_A444:
|
||||
case GST_VIDEO_FORMAT_A444_16LE:
|
||||
return "A420";
|
||||
case GST_VIDEO_FORMAT_A420_10LE:
|
||||
case GST_VIDEO_FORMAT_A422_10LE:
|
||||
case GST_VIDEO_FORMAT_A444_10LE:
|
||||
return "A420_10";
|
||||
case GST_VIDEO_FORMAT_A420_12LE:
|
||||
case GST_VIDEO_FORMAT_A422_12LE:
|
||||
case GST_VIDEO_FORMAT_A444_12LE:
|
||||
return "A420_12";
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
|
@ -806,6 +825,23 @@ conv_ps_make_output (GstVideoFormat format, gboolean premul)
|
|||
ret.push_back({PS_OUTPUT::LUMA, "Luma_10"});
|
||||
ret.push_back({PS_OUTPUT::CHROMA_PLANAR, "ChromaI420_10"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_A420:
|
||||
case GST_VIDEO_FORMAT_A420_16LE:
|
||||
case GST_VIDEO_FORMAT_A422:
|
||||
case GST_VIDEO_FORMAT_A422_16LE:
|
||||
ret.push_back({PS_OUTPUT::LUMA_ALPHA, "LumaAlphaA420"});
|
||||
ret.push_back({PS_OUTPUT::CHROMA_PLANAR, "ChromaI420"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_A420_10LE:
|
||||
case GST_VIDEO_FORMAT_A422_10LE:
|
||||
ret.push_back({PS_OUTPUT::LUMA_ALPHA, "LumaAlphaA420_10"});
|
||||
ret.push_back({PS_OUTPUT::CHROMA_PLANAR, "ChromaI420_10"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_A420_12LE:
|
||||
case GST_VIDEO_FORMAT_A422_12LE:
|
||||
ret.push_back({PS_OUTPUT::LUMA_ALPHA, "LumaAlphaA420_12"});
|
||||
ret.push_back({PS_OUTPUT::CHROMA_PLANAR, "ChromaI420_12"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_Y444_10LE:
|
||||
ret.push_back({PS_OUTPUT::PLANAR, "Y444_10"});
|
||||
break;
|
||||
|
@ -855,6 +891,16 @@ conv_ps_make_output (GstVideoFormat format, gboolean premul)
|
|||
else
|
||||
ret.push_back({PS_OUTPUT::PLANAR_FULL, "GBRA_12"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_A444:
|
||||
case GST_VIDEO_FORMAT_A444_16LE:
|
||||
ret.push_back({PS_OUTPUT::PLANAR_FULL, "A444"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_A444_10LE:
|
||||
ret.push_back({PS_OUTPUT::PLANAR_FULL, "A444_10"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_A444_12LE:
|
||||
ret.push_back({PS_OUTPUT::PLANAR_FULL, "A444_12"});
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_RBGA:
|
||||
if (premul)
|
||||
ret.push_back({PS_OUTPUT::PACKED, "RBGAPremul"});
|
||||
|
|
Loading…
Reference in a new issue