Bug 1543359 - P9. Add YUV range information to NV12Effect and YCbCrEffect. r=mattwoodrow

This is used by the OGL and D3D11 compositors.

Differential Revision: https://phabricator.services.mozilla.com/D27242

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-07-26 08:45:26 +00:00
parent b14a14b66a
commit 235b08fe18

View File

@ -140,21 +140,26 @@ struct EffectRGB : public TexturedEffect {
struct EffectYCbCr : public TexturedEffect {
EffectYCbCr(TextureSource* aSource, gfx::YUVColorSpace aYUVColorSpace,
gfx::ColorDepth aColorDepth, gfx::SamplingFilter aSamplingFilter)
gfx::ColorRange aColorRange, gfx::ColorDepth aColorDepth,
gfx::SamplingFilter aSamplingFilter)
: TexturedEffect(EffectTypes::YCBCR, aSource, false, aSamplingFilter),
mYUVColorSpace(aYUVColorSpace),
mColorRange(aColorRange),
mColorDepth(aColorDepth) {}
const char* Name() override { return "EffectYCbCr"; }
gfx::YUVColorSpace mYUVColorSpace;
gfx::ColorRange mColorRange;
gfx::ColorDepth mColorDepth;
};
struct EffectNV12 : public EffectYCbCr {
EffectNV12(TextureSource* aSource, gfx::YUVColorSpace aYUVColorSpace,
gfx::ColorDepth aColorDepth, gfx::SamplingFilter aSamplingFilter)
: EffectYCbCr(aSource, aYUVColorSpace, aColorDepth, aSamplingFilter) {
gfx::ColorRange aColorRange, gfx::ColorDepth aColorDepth,
gfx::SamplingFilter aSamplingFilter)
: EffectYCbCr(aSource, aYUVColorSpace, aColorRange, aColorDepth,
aSamplingFilter) {
mType = EffectTypes::NV12;
}
@ -243,13 +248,15 @@ inline already_AddRefed<TexturedEffect> CreateTexturedEffect(
case gfx::SurfaceFormat::YUV:
MOZ_ASSERT(aHost->GetYUVColorSpace() != gfx::YUVColorSpace::UNKNOWN);
result = new EffectYCbCr(aSource, aHost->GetYUVColorSpace(),
aHost->GetColorDepth(), aSamplingFilter);
aHost->GetColorRange(), aHost->GetColorDepth(),
aSamplingFilter);
break;
case gfx::SurfaceFormat::NV12:
case gfx::SurfaceFormat::P010:
case gfx::SurfaceFormat::P016:
result = new EffectNV12(aSource, aHost->GetYUVColorSpace(),
aHost->GetColorDepth(), aSamplingFilter);
aHost->GetColorRange(), aHost->GetColorDepth(),
aSamplingFilter);
break;
default:
result = CreateTexturedEffect(aHost->GetReadFormat(), aSource,