mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-30 17:58:37 +08:00
libobs: Add support for reading I420 HLG
Sony cameras can create 8-bit HLG videos for some reason.
This commit is contained in:
@@ -485,6 +485,19 @@ float4 PSPlanar420_PQ_Reverse(VertTexPos frag_in) : TARGET
|
||||
return float4(rgb, 1.);
|
||||
}
|
||||
|
||||
float4 PSPlanar420_HLG_Reverse(VertTexPos frag_in) : TARGET
|
||||
{
|
||||
float y = image.Load(int3(frag_in.pos.xy, 0)).x;
|
||||
int3 xy0_chroma = int3(frag_in.uv, 0);
|
||||
float cb = image1.Load(xy0_chroma).x;
|
||||
float cr = image2.Load(xy0_chroma).x;
|
||||
float3 yuv = float3(y, cb, cr);
|
||||
float3 hlg = YUV_to_RGB(yuv);
|
||||
float3 hdr2020 = hlg_to_linear(hlg, hlg_exponent) * maximum_over_sdr_white_nits;
|
||||
float3 rgb = rec2020_to_rec709(hdr2020);
|
||||
return float4(rgb, 1.);
|
||||
}
|
||||
|
||||
float4 PSPlanar420A_Reverse(VertTexPos frag_in) : TARGET
|
||||
{
|
||||
int3 xy0_luma = int3(frag_in.pos.xy, 0);
|
||||
@@ -966,6 +979,15 @@ technique I420_PQ_Reverse
|
||||
}
|
||||
}
|
||||
|
||||
technique I420_HLG_Reverse
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_shader = VSTexPosHalfHalf_Reverse(id);
|
||||
pixel_shader = PSPlanar420_HLG_Reverse(frag_in);
|
||||
}
|
||||
}
|
||||
|
||||
technique I40A_Reverse
|
||||
{
|
||||
pass
|
||||
|
||||
+8
-2
@@ -2084,8 +2084,14 @@ static const char *select_conversion_technique(enum video_format format,
|
||||
return "YVYU_Reverse";
|
||||
|
||||
case VIDEO_FORMAT_I420:
|
||||
return (trc == VIDEO_TRC_PQ) ? "I420_PQ_Reverse"
|
||||
: "I420_Reverse";
|
||||
switch (trc) {
|
||||
case VIDEO_TRC_PQ:
|
||||
return "I420_PQ_Reverse";
|
||||
case VIDEO_TRC_HLG:
|
||||
return "I420_HLG_Reverse";
|
||||
default:
|
||||
return "I420_Reverse";
|
||||
}
|
||||
|
||||
case VIDEO_FORMAT_NV12:
|
||||
return "NV12_Reverse";
|
||||
|
||||
Reference in New Issue
Block a user