From 5aa7e8ee09d84370c0c1d5d69dfaf6cbbc9b4164 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Mon, 22 Jul 2019 07:27:39 +0000 Subject: [PATCH] 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 --- gfx/layers/Effects.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gfx/layers/Effects.h b/gfx/layers/Effects.h index 62f18c37fddc8..416c7d3d701e8 100644 --- a/gfx/layers/Effects.h +++ b/gfx/layers/Effects.h @@ -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 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,