Skip to content

Commit

Permalink
Bug 1543359 - P9. Add YUV range information to NV12Effect and YCbCrEf…
Browse files Browse the repository at this point in the history
…fect. 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
  • Loading branch information
Jean-Yves Avenard committed Jul 26, 2019
1 parent a9add66 commit ace0cc7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions gfx/layers/Effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ace0cc7

Please sign in to comment.