Use a more concise representation of YUV -> RGB conversion
This commit is contained in:
1 parent
8afba41aef
commit
985da79d73
6 files changed
+6369
-6315
No files matched your search
@@ -162,9 +162,7 @@ fragment float4 SDL_Copy_fragment(CopyVertexOutput vert [[stage_in]],
|
|||||||
struct YUVDecode
|
struct YUVDecode
|
||||||
{
|
{
|
||||||
float3 offset;
|
float3 offset;
|
||||||
float3 Rcoeff;
|
float3x3 matrix;
|
||||||
float3 Gcoeff;
|
|
||||||
float3 Bcoeff;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]],
|
fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]],
|
||||||
@@ -180,10 +178,7 @@ fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]],
|
|||||||
yuv.z = texUV.sample(s, vert.texcoord, 1).r;
|
yuv.z = texUV.sample(s, vert.texcoord, 1).r;
|
||||||
|
|
||||||
float3 rgb;
|
float3 rgb;
|
||||||
yuv += decode.offset;
|
rgb = (yuv + decode.offset) * decode.matrix;
|
||||||
rgb.r = dot(yuv, decode.Rcoeff);
|
|
||||||
rgb.g = dot(yuv, decode.Gcoeff);
|
|
||||||
rgb.b = dot(yuv, decode.Bcoeff);
|
|
||||||
|
|
||||||
return GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
return GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
||||||
}
|
}
|
||||||
@@ -200,10 +195,7 @@ fragment float4 SDL_NV12_fragment(CopyVertexOutput vert [[stage_in]],
|
|||||||
yuv.yz = texUV.sample(s, vert.texcoord).rg;
|
yuv.yz = texUV.sample(s, vert.texcoord).rg;
|
||||||
|
|
||||||
float3 rgb;
|
float3 rgb;
|
||||||
yuv += decode.offset;
|
rgb = (yuv + decode.offset) * decode.matrix;
|
||||||
rgb.r = dot(yuv, decode.Rcoeff);
|
|
||||||
rgb.g = dot(yuv, decode.Gcoeff);
|
|
||||||
rgb.b = dot(yuv, decode.Bcoeff);
|
|
||||||
|
|
||||||
return GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
return GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
||||||
}
|
}
|
||||||
@@ -220,10 +212,7 @@ fragment float4 SDL_NV21_fragment(CopyVertexOutput vert [[stage_in]],
|
|||||||
yuv.yz = texUV.sample(s, vert.texcoord).gr;
|
yuv.yz = texUV.sample(s, vert.texcoord).gr;
|
||||||
|
|
||||||
float3 rgb;
|
float3 rgb;
|
||||||
yuv += decode.offset;
|
rgb = (yuv + decode.offset) * decode.matrix;
|
||||||
rgb.r = dot(yuv, decode.Rcoeff);
|
|
||||||
rgb.g = dot(yuv, decode.Gcoeff);
|
|
||||||
rgb.b = dot(yuv, decode.Bcoeff);
|
|
||||||
|
|
||||||
return GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
return GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
||||||
}
|
}
|
||||||
@@ -246,10 +235,7 @@ fragment float4 SDL_HDR10_fragment(CopyVertexOutput vert [[stage_in]],
|
|||||||
yuv.yz = texUV.sample(s, vert.texcoord).rg;
|
yuv.yz = texUV.sample(s, vert.texcoord).rg;
|
||||||
|
|
||||||
float3 rgb;
|
float3 rgb;
|
||||||
yuv += decode.offset;
|
rgb = (yuv + decode.offset) * decode.matrix;
|
||||||
rgb.r = dot(yuv, decode.Rcoeff);
|
|
||||||
rgb.g = dot(yuv, decode.Gcoeff);
|
|
||||||
rgb.b = dot(yuv, decode.Bcoeff);
|
|
||||||
|
|
||||||
rgb = PQtoNits(rgb);
|
rgb = PQtoNits(rgb);
|
||||||
|
|
||||||
|
|||||||
+1179
-1163
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+1136
-1120
File diff suppressed because it is too large.
Load diff
+1179
-1163
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user