mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 15:27:32 +09:00
Issue #2101 - Part 7: Add color range support on GPUs
This commit is contained in:
parent
2b88f2c9ac
commit
687733f9d1
18 changed files with 106 additions and 74 deletions
|
|
@ -886,7 +886,8 @@ CompositorD3D11::DrawQuad(const gfx::Rect& aRect,
|
|||
return;
|
||||
}
|
||||
|
||||
const float* yuvToRgb = gfxUtils::Get4x3YuvColorMatrix(ycbcrEffect->mYUVColorSpace);
|
||||
const float* yuvToRgb = gfxUtils::YuvToRgbMatrix4x4XRowMajor(
|
||||
ycbcrEffect->mYUVColorSpace, ycbcrEffect->mColorRange);
|
||||
memcpy(&mPSConstants.yuvColorMatrix, yuvToRgb, sizeof(mPSConstants.yuvColorMatrix));
|
||||
|
||||
TextureSourceD3D11* sourceY = source->GetSubSource(Y)->AsSourceD3D11();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ struct PixelShaderConstants
|
|||
float layerColor[4];
|
||||
float layerOpacity[4];
|
||||
int blendConfig[4];
|
||||
float yuvColorMatrix[3][4];
|
||||
float yuvColorMatrix[4][4];
|
||||
};
|
||||
|
||||
struct DeviceAttachmentsD3D11;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ float fLayerOpacity : register(ps, c1);
|
|||
// w = is premultiplied
|
||||
uint4 iBlendConfig : register(ps, c2);
|
||||
|
||||
row_major float3x3 mYuvColorMatrix : register(ps, c3);
|
||||
row_major float4x4 mYuvColorMatrix : register(ps, c3);
|
||||
|
||||
sampler sSampler : register(ps, s0);
|
||||
|
||||
|
|
@ -205,17 +205,14 @@ For [0,1] instead of [0,255], and to 5 places:
|
|||
*/
|
||||
float4 CalculateYCbCrColor(const float2 aTexCoords)
|
||||
{
|
||||
float3 yuv;
|
||||
float4 color;
|
||||
float4 yuv;
|
||||
|
||||
yuv.x = tY.Sample(sSampler, aTexCoords).r - 0.06275;
|
||||
yuv.y = tCb.Sample(sSampler, aTexCoords).r - 0.50196;
|
||||
yuv.z = tCr.Sample(sSampler, aTexCoords).r - 0.50196;
|
||||
yuv.x = tY.Sample(sSampler, aTexCoords).r;
|
||||
yuv.y = tCb.Sample(sSampler, aTexCoords).r;
|
||||
yuv.z = tCr.Sample(sSampler, aTexCoords).r;
|
||||
yuv.w = 1.0;
|
||||
|
||||
color.rgb = mul(mYuvColorMatrix, yuv);
|
||||
color.a = 1.0f;
|
||||
|
||||
return color;
|
||||
return mul(mYuvColorMatrix, yuv);
|
||||
}
|
||||
|
||||
float4 YCbCrShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
|
||||
|
|
|
|||
|
|
@ -361,6 +361,7 @@ public:
|
|||
|
||||
// Bug 1305906 fixes YUVColorSpace handling
|
||||
virtual YUVColorSpace GetYUVColorSpace() const override { return YUVColorSpace::BT601; }
|
||||
virtual ColorRange GetColorRange() const override { return ColorRange::LIMITED; }
|
||||
|
||||
virtual bool Lock() override;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue