Backed out 15 changesets (bug 1543359) for wrench bustages on image.rs . CLOSED TREE

Backed out changeset 548006270186 (bug 1543359)
Backed out changeset c9585e9d9f3c (bug 1543359)
Backed out changeset 1c7ca95a2a9b (bug 1543359)
Backed out changeset d742d80b892f (bug 1543359)
Backed out changeset 210eee703fd9 (bug 1543359)
Backed out changeset 4eb933d55d88 (bug 1543359)
Backed out changeset fb9b71ed9f4b (bug 1543359)
Backed out changeset 98b968443458 (bug 1543359)
Backed out changeset a85bd4691bea (bug 1543359)
Backed out changeset b576317853e9 (bug 1543359)
Backed out changeset 095bca5c9b1a (bug 1543359)
Backed out changeset 48eb0ebf9f2e (bug 1543359)
Backed out changeset b22b0eb708b8 (bug 1543359)
Backed out changeset 52187d9320b1 (bug 1543359)
Backed out changeset fa6792c1c2e8 (bug 1543359)
This commit is contained in:
Narcis Beleuzu 2019-07-26 11:40:33 +03:00
Родитель 88ca735e1d
Коммит e84980d8b1
81 изменённых файлов: 188 добавлений и 459 удалений

Просмотреть файл

@ -308,9 +308,6 @@ bool VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
return false;
}
MOZ_ASSERT(aBuffer.mYUVColorSpace != gfx::YUVColorSpace::UNKNOWN,
"We must know the colorframe at this point");
PlanarYCbCrData data = ConstructPlanarYCbCrData(aInfo, aBuffer, aPicture);
aVideoImage->SetDelayedConversion(true);
@ -339,9 +336,6 @@ already_AddRefed<VideoData> VideoData::CreateAndCopyData(
return nullptr;
}
MOZ_ASSERT(aBuffer.mYUVColorSpace != gfx::YUVColorSpace::UNKNOWN,
"We must know the colorframe at this point");
RefPtr<VideoData> v(new VideoData(aOffset, aTime, aDuration, aKeyframe,
aTimecode, aInfo.mDisplay, 0));

Просмотреть файл

@ -422,7 +422,6 @@ class VideoData : public MediaData {
typedef gfx::IntRect IntRect;
typedef gfx::IntSize IntSize;
typedef gfx::ColorDepth ColorDepth;
typedef gfx::ColorRange ColorRange;
typedef gfx::YUVColorSpace YUVColorSpace;
typedef layers::ImageContainer ImageContainer;
typedef layers::Image Image;
@ -446,9 +445,8 @@ class VideoData : public MediaData {
};
Plane mPlanes[3];
YUVColorSpace mYUVColorSpace = YUVColorSpace::UNKNOWN;
YUVColorSpace mYUVColorSpace = YUVColorSpace::BT601;
ColorDepth mColorDepth = ColorDepth::COLOR_8;
ColorRange mColorRange = ColorRange::LIMITED;
};
class Listener {

Просмотреть файл

@ -251,7 +251,7 @@ class VideoInfo : public TrackInfo {
// True indicates no restriction on Y, U, V values (otherwise 16-235 for 8
// bits etc)
gfx::ColorRange mColorRange = gfx::ColorRange::LIMITED;
bool mFullRange = false;
private:
// mImage may be cropped; currently only used with the WebM container.

Просмотреть файл

@ -25,11 +25,6 @@ static bool SetImageToBlackPixel(PlanarYCbCrImage* aImage) {
data.mCrChannel = blackPixel + 2;
data.mYStride = data.mCbCrStride = 1;
data.mPicSize = data.mYSize = data.mCbCrSize = gfx::IntSize(1, 1);
data.mYUVColorSpace = gfx::YUVColorSpace::BT601;
// This could be made FULL once bug 1568745 is complete. A black pixel being
// 0x00, 0x80, 0x80
data.mColorRange = gfx::ColorRange::LIMITED;
return aImage->CopyData(data);
}

Просмотреть файл

@ -8,7 +8,6 @@
#include "gfx2DGlue.h"
#include "ImageContainer.h"
#include "Layers.h"
#include "VideoUtils.h"
#include "mozilla/UniquePtr.h"
namespace mozilla {
@ -77,10 +76,6 @@ already_AddRefed<Image> VideoFrame::CreateBlackImage(
data.mPicY = 0;
data.mPicSize = gfx::IntSize(aSize.width, aSize.height);
data.mStereoMode = StereoMode::MONO;
data.mYUVColorSpace = gfx::YUVColorSpace::BT601;
// This could be made FULL once bug 1568745 is complete. A black pixel being
// 0x00, 0x80, 0x80
data.mColorRange = gfx::ColorRange::LIMITED;
// Copies data, so we can free data.
if (!image->CopyData(data)) {

Просмотреть файл

@ -12,7 +12,6 @@
#include "TimeUnits.h"
#include "VideoLimits.h"
#include "mozilla/gfx/Point.h" // for gfx::IntSize
#include "mozilla/gfx/Types.h"
#include "mozilla/AbstractThread.h"
#include "mozilla/Attributes.h"
#include "mozilla/CheckedInt.h"
@ -551,11 +550,6 @@ inline void AppendStringIfNotEmpty(nsACString& aDest, nsACString&& aSrc) {
// Main thread only.
bool OnCellularConnection();
inline gfx::YUVColorSpace DefaultColorSpace(const gfx::IntSize& aSize) {
return aSize.height < 720 ? gfx::YUVColorSpace::BT601
: gfx::YUVColorSpace::BT709;
}
} // end namespace mozilla
#endif

Просмотреть файл

@ -769,11 +769,6 @@ already_AddRefed<VideoData> ChromiumCDMParent::CreateVideoFrame(
b.mPlanes[2].mOffset = aFrame.mVPlane().mPlaneOffset();
b.mPlanes[2].mSkip = 0;
// We unfortunately can't know which colorspace the video is using at this
// stage.
b.mYUVColorSpace =
DefaultColorSpace({aFrame.mImageWidth(), aFrame.mImageHeight()});
gfx::IntRect pictureRegion(0, 0, aFrame.mImageWidth(), aFrame.mImageHeight());
RefPtr<VideoData> v = VideoData::CreateAndCopyData(
mVideoInfo, mImageContainer, mLastStreamOffset,

Просмотреть файл

@ -6,8 +6,6 @@
#include "YUVBufferGenerator.h"
#include "VideoUtils.h"
using namespace mozilla::layers;
using namespace mozilla;
@ -76,8 +74,6 @@ Image* YUVBufferGenerator::CreateI420Image() {
data.mCbCrSize.width = halfWidth;
data.mCbCrSize.height = halfHeight;
data.mYUVColorSpace = DefaultColorSpace(data.mYSize);
image->CopyData(data);
return image;
}
@ -150,8 +146,6 @@ Image* YUVBufferGenerator::CreateNV21Image() {
data.mCbCrSize.width = halfWidth;
data.mCbCrSize.height = halfHeight;
data.mYUVColorSpace = DefaultColorSpace(data.mYSize);
image->SetData(data);
return image;
}

Просмотреть файл

@ -31,7 +31,7 @@ struct ParamTraits<mozilla::VideoInfo> {
WriteParam(aMsg, aParam.mRotation);
WriteParam(aMsg, aParam.mColorDepth);
WriteParam(aMsg, aParam.mColorSpace);
WriteParam(aMsg, aParam.mColorRange);
WriteParam(aMsg, aParam.mFullRange);
WriteParam(aMsg, aParam.HasAlpha());
}
@ -49,7 +49,7 @@ struct ParamTraits<mozilla::VideoInfo> {
ReadParam(aMsg, aIter, &aResult->mRotation) &&
ReadParam(aMsg, aIter, &aResult->mColorDepth) &&
ReadParam(aMsg, aIter, &aResult->mColorSpace) &&
ReadParam(aMsg, aIter, &aResult->mColorRange) &&
ReadParam(aMsg, aIter, &aResult->mFullRange) &&
ReadParam(aMsg, aIter, &alphaPresent)) {
aResult->SetImageRect(imageRect);
aResult->SetAlpha(alphaPresent);

Просмотреть файл

@ -85,7 +85,6 @@ static void SetImageToGreenPixel(PlanarYCbCrImage* aImage) {
data.mCrChannel = greenPixel + 2;
data.mYStride = data.mCbCrStride = 1;
data.mPicSize = data.mYSize = data.mCbCrSize = gfx::IntSize(1, 1);
data.mYUVColorSpace = gfx::YUVColorSpace::BT601;
aImage->CopyData(data);
}

Просмотреть файл

@ -200,14 +200,11 @@ RefPtr<MediaDataDecoder::DecodePromise> AOMDecoder::ProcessDecode(
b.mYUVColorSpace = YUVColorSpace::BT2020;
break;
case AOM_CICP_MC_BT_709:
default:
// Set 709 as default, as it's the most sane default.
b.mYUVColorSpace = YUVColorSpace::BT709;
break;
default:
b.mYUVColorSpace = DefaultColorSpace({img->d_w, img->d_h});
break;
}
b.mColorRange = img->range == AOM_CR_FULL_RANGE ? ColorRange::FULL
: ColorRange::LIMITED;
RefPtr<VideoData> v;
v = VideoData::CreateAndCopyData(mInfo, mImageContainer, aSample->mOffset,

Просмотреть файл

@ -70,8 +70,6 @@ already_AddRefed<MediaData> BlankVideoDataCreator::Create(
buffer.mPlanes[2].mOffset = 0;
buffer.mPlanes[2].mSkip = 0;
buffer.mYUVColorSpace = gfx::YUVColorSpace::BT601;
return VideoData::CreateAndCopyData(
mInfo, mImageContainer, aSample->mOffset, aSample->mTime,
aSample->mDuration, buffer, aSample->mKeyframe, aSample->mTime, mPicture);

Просмотреть файл

@ -194,17 +194,15 @@ already_AddRefed<VideoData> DAV1DDecoder::ConstructImage(
b.mYUVColorSpace = YUVColorSpace::BT601;
break;
case DAV1D_MC_BT709:
default:
// Set 709 as default, as it's the most sane default.
b.mYUVColorSpace = YUVColorSpace::BT709;
break;
default:
break;
}
} else {
// BT709 is the only default that makes sense in a modern video context.
b.mYUVColorSpace = YUVColorSpace::BT709;
}
if (b.mYUVColorSpace == YUVColorSpace::UNKNOWN) {
b.mYUVColorSpace = DefaultColorSpace({aPicture.p.w, aPicture.p.h});
}
b.mColorRange = aPicture.seq_hdr->color_range ? gfx::ColorRange::FULL
: gfx::ColorRange::LIMITED;
b.mPlanes[0].mData = static_cast<uint8_t*>(aPicture.data[0]);
b.mPlanes[0].mStride = aPicture.stride[0];

Просмотреть файл

@ -166,9 +166,6 @@ RefPtr<MediaDataDecoder::DecodePromise> TheoraDecoder::ProcessDecode(
b.mPlanes[2].mWidth = mTheoraInfo.frame_width >> hdec;
b.mPlanes[2].mOffset = b.mPlanes[2].mSkip = 0;
b.mYUVColorSpace =
DefaultColorSpace({mTheoraInfo.frame_width, mTheoraInfo.frame_height});
IntRect pictureArea(mTheoraInfo.pic_x, mTheoraInfo.pic_y,
mTheoraInfo.pic_width, mTheoraInfo.pic_height);

Просмотреть файл

@ -177,22 +177,6 @@ RefPtr<MediaDataDecoder::DecodePromise> VPXDecoder::ProcessDecode(
RESULT_DETAIL("VPX Unknown image format")),
__func__);
}
b.mYUVColorSpace = [&]() {
switch (img->cs) {
case VPX_CS_BT_601:
case VPX_CS_SMPTE_170:
case VPX_CS_SMPTE_240:
return gfx::YUVColorSpace::BT601;
case VPX_CS_BT_709:
return gfx::YUVColorSpace::BT709;
case VPX_CS_BT_2020:
return gfx::YUVColorSpace::BT2020;
default:
return DefaultColorSpace({img->d_w, img->d_h});
}
}();
b.mColorRange = img->range == VPX_CR_FULL_RANGE ? gfx::ColorRange::FULL
: gfx::ColorRange::LIMITED;
RefPtr<VideoData> v;
if (!img_alpha) {

Просмотреть файл

@ -111,10 +111,6 @@ class VPXDecoder : public MediaDataDecoder,
*/
bool mFullRange = false;
gfx::ColorRange ColorRange() const {
return mFullRange ? gfx::ColorRange::FULL : gfx::ColorRange::LIMITED;
}
/*
Sub-sampling, used only for non sRGB colorspace.
subsampling_x subsampling_y Description

Просмотреть файл

@ -56,9 +56,6 @@ void GMPVideoDecoder::Decoded(GMPVideoi420Frame* aDecodedFrame) {
b.mPlanes[i].mSkip = 0;
}
b.mYUVColorSpace =
DefaultColorSpace({decodedFrame->Width(), decodedFrame->Height()});
gfx::IntRect pictureRegion(0, 0, decodedFrame->Width(),
decodedFrame->Height());
RefPtr<VideoData> v = VideoData::CreateAndCopyData(

Просмотреть файл

@ -35,10 +35,7 @@ AppleVTDecoder::AppleVTDecoder(const VideoInfo& aConfig, TaskQueue* aTaskQueue,
mPictureHeight(aConfig.mImage.height),
mDisplayWidth(aConfig.mDisplay.width),
mDisplayHeight(aConfig.mDisplay.height),
mColorSpace(aConfig.mColorSpace == gfx::YUVColorSpace::UNKNOWN
? DefaultColorSpace({mPictureWidth, mPictureHeight})
: aConfig.mColorSpace),
mColorRange(aConfig.mColorRange),
mColorSpace(aConfig.mColorSpace),
mTaskQueue(aTaskQueue),
mMaxRefFrames(aOptions.contains(CreateDecoderParams::Option::LowLatency)
? 0
@ -378,7 +375,6 @@ void AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage,
buffer.mPlanes[2].mSkip = 0;
buffer.mYUVColorSpace = mColorSpace;
buffer.mColorRange = mColorRange;
gfx::IntRect visible = gfx::IntRect(0, 0, mPictureWidth, mPictureHeight);
@ -550,10 +546,7 @@ CFDictionaryRef AppleVTDecoder::CreateOutputConfiguration() {
#ifndef MOZ_WIDGET_UIKIT
// Output format type:
SInt32 PixelFormatTypeValue =
mColorRange == gfx::ColorRange::FULL
? kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
: kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
SInt32 PixelFormatTypeValue = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
AutoCFRelease<CFNumberRef> PixelFormatTypeNumber = CFNumberCreate(
kCFAllocatorDefault, kCFNumberSInt32Type, &PixelFormatTypeValue);
// Construct IOSurface Properties

Просмотреть файл

@ -89,7 +89,6 @@ class AppleVTDecoder : public MediaDataDecoder,
const uint32_t mDisplayWidth;
const uint32_t mDisplayHeight;
const gfx::YUVColorSpace mColorSpace;
const gfx::ColorRange mColorRange;
// Method to set up the decompression session.
MediaResult InitializeSession();

Просмотреть файл

@ -151,7 +151,6 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 |
AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
AV_FUNC_OPTION(av_frame_get_colorspace, AV_FUNC_AVUTIL_ALL)
AV_FUNC_OPTION(av_frame_get_color_range, AV_FUNC_AVUTIL_ALL)
#undef AV_FUNC
#undef AV_FUNC_OPTION

Просмотреть файл

@ -101,7 +101,7 @@ struct MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS FFmpegLibWrapper {
// libavutil optional
int (*av_frame_get_colorspace)(const AVFrame* frame);
int (*av_frame_get_color_range)(const AVFrame* frame);
PRLibrary* mAVCodecLib;
PRLibrary* mAVUtilLib;

Просмотреть файл

@ -381,22 +381,16 @@ MediaResult FFmpegVideoDecoder<LIBAV_VER>::CreateImage(
b.mYUVColorSpace = gfx::YUVColorSpace::BT601;
break;
case AVCOL_SPC_UNSPECIFIED:
b.mYUVColorSpace = gfx::YUVColorSpace::UNKNOWN;
#if LIBAVCODEC_VERSION_MAJOR >= 55
if (mCodecContext->codec_id == AV_CODEC_ID_VP9) {
b.mYUVColorSpace = gfx::YUVColorSpace::BT709;
}
#endif
break;
default:
break;
}
}
if (b.mYUVColorSpace == gfx::YUVColorSpace::UNKNOWN) {
b.mYUVColorSpace = DefaultColorSpace({mFrame->width, mFrame->height});
}
if (mLib->av_frame_get_color_range) {
auto range = mLib->av_frame_get_color_range(mFrame);
b.mColorRange = range == AVCOL_RANGE_JPEG ? gfx::ColorRange::FULL
: gfx::ColorRange::LIMITED;
}
RefPtr<VideoData> v = VideoData::CreateAndCopyData(
mInfo, mImageContainer, aOffset, TimeUnit::FromMicroseconds(aPts),
TimeUnit::FromMicroseconds(aDuration), b, !!mFrame->key_frame,

Просмотреть файл

@ -35,8 +35,6 @@
namespace mozilla {
using namespace gfx;
static const char* StateTypeToStr(OMX_STATETYPE aType) {
MOZ_ASSERT(aType == OMX_StateLoaded || aType == OMX_StateIdle ||
aType == OMX_StateExecuting || aType == OMX_StatePause ||
@ -938,11 +936,6 @@ already_AddRefed<VideoData> MediaDataHelper::CreateYUV420VideoData(
b.mPlanes[2].mOffset = 0;
b.mPlanes[2].mSkip = 0;
b.mYUVColorSpace =
mTrackInfo->GetAsVideoInfo()->mColorSpace == YUVColorSpace::UNKNOWN
? DefaultColorSpace({width, height})
: mTrackInfo->GetAsVideoInfo()->mColorSpace;
VideoInfo info(*mTrackInfo->GetAsVideoInfo());
RefPtr<VideoData> data = VideoData::CreateAndCopyData(
info, mImageContainer,

Просмотреть файл

@ -593,8 +593,7 @@ class D3D11DXVA2Manager : public DXVA2Manager {
ID3D11Texture2D** aOutTexture) override;
HRESULT ConfigureForSize(IMFMediaType* aInputType,
gfx::YUVColorSpace aColorSpace,
gfx::ColorRange aColorRange, uint32_t aWidth,
gfx::YUVColorSpace aColorSpace, uint32_t aWidth,
uint32_t aHeight) override;
bool IsD3D11() override { return true; }
@ -626,8 +625,7 @@ class D3D11DXVA2Manager : public DXVA2Manager {
UINT mDeviceManagerToken = 0;
RefPtr<IMFMediaType> mInputType;
GUID mInputSubType;
gfx::YUVColorSpace mYUVColorSpace = gfx::YUVColorSpace::UNKNOWN;
gfx::ColorRange mColorRange = gfx::ColorRange::LIMITED;
gfx::YUVColorSpace mYUVColorSpace = gfx::YUVColorSpace::BT601;
};
bool D3D11DXVA2Manager::SupportsConfig(IMFMediaType* aType, float aFramerate) {
@ -890,7 +888,7 @@ D3D11DXVA2Manager::CopyToImage(IMFSample* aVideoSample,
MOZ_ASSERT(mTextureClientAllocator);
RefPtr<D3D11ShareHandleImage> image = new D3D11ShareHandleImage(
gfx::IntSize(mWidth, mHeight), aRegion, mYUVColorSpace, mColorRange);
gfx::IntSize(mWidth, mHeight), aRegion, mYUVColorSpace);
// Retrieve the DXGI_FORMAT for the current video sample.
RefPtr<IMFMediaBuffer> buffer;
@ -1024,8 +1022,7 @@ D3D11DXVA2Manager::CopyToBGRATexture(ID3D11Texture2D* aInTexture,
hr = inputType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
hr = ConfigureForSize(inputType, mYUVColorSpace, mColorRange, desc.Width,
desc.Height);
hr = ConfigureForSize(inputType, mYUVColorSpace, desc.Width, desc.Height);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
}
@ -1092,14 +1089,13 @@ D3D11DXVA2Manager::CopyToBGRATexture(ID3D11Texture2D* aInTexture,
HRESULT
D3D11DXVA2Manager::ConfigureForSize(IMFMediaType* aInputType,
gfx::YUVColorSpace aColorSpace,
gfx::ColorRange aColorRange,
uint32_t aWidth, uint32_t aHeight) {
GUID subType = {0};
HRESULT hr = aInputType->GetGUID(MF_MT_SUBTYPE, &subType);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
if (subType == mInputSubType && aWidth == mWidth && aHeight == mHeight &&
mYUVColorSpace == aColorSpace && mColorRange == aColorRange) {
mYUVColorSpace == aColorSpace) {
// If the media type hasn't changed, don't reconfigure.
return S_OK;
}
@ -1157,7 +1153,6 @@ D3D11DXVA2Manager::ConfigureForSize(IMFMediaType* aInputType,
mInputType = inputType;
mInputSubType = subType;
mYUVColorSpace = aColorSpace;
mColorRange = aColorRange;
if (mTextureClientAllocator) {
gfx::SurfaceFormat format = [&]() {
if (subType == MFVideoFormat_NV12) {

Просмотреть файл

@ -51,8 +51,7 @@ class DXVA2Manager {
virtual HRESULT ConfigureForSize(IMFMediaType* aInputType,
gfx::YUVColorSpace aColorSpace,
gfx::ColorRange aColorRange, uint32_t aWidth,
uint32_t aHeight) {
uint32_t aWidth, uint32_t aHeight) {
return S_OK;
}

Просмотреть файл

@ -68,7 +68,7 @@ GetDefaultStride(IMFMediaType* aType, uint32_t aWidth, uint32_t* aOutStride) {
gfx::YUVColorSpace GetYUVColorSpace(IMFMediaType* aType) {
UINT32 yuvColorMatrix;
HRESULT hr = aType->GetUINT32(MF_MT_YUV_MATRIX, &yuvColorMatrix);
NS_ENSURE_TRUE(SUCCEEDED(hr), gfx::YUVColorSpace::UNKNOWN);
NS_ENSURE_TRUE(SUCCEEDED(hr), gfx::YUVColorSpace::BT601);
switch (yuvColorMatrix) {
case MFVideoTransferMatrix_BT2020_10:
@ -77,9 +77,8 @@ gfx::YUVColorSpace GetYUVColorSpace(IMFMediaType* aType) {
case MFVideoTransferMatrix_BT709:
return gfx::YUVColorSpace::BT709;
case MFVideoTransferMatrix_BT601:
return gfx::YUVColorSpace::BT601;
default:
return gfx::YUVColorSpace::UNKNOWN;
return gfx::YUVColorSpace::BT601;
}
}

Просмотреть файл

@ -139,7 +139,6 @@ WMFVideoMFTManager::WMFVideoMFTManager(
mColorSpace(aConfig.mColorSpace != gfx::YUVColorSpace::UNKNOWN
? Some(aConfig.mColorSpace)
: Nothing()),
mColorRange(aConfig.mColorRange),
mImageContainer(aImageContainer),
mKnowsCompositor(aKnowsCompositor),
mDXVAEnabled(aDXVAEnabled &&
@ -662,11 +661,8 @@ MediaResult WMFVideoMFTManager::InitInternal() {
if (mUseHwAccel) {
hr = mDXVA2Manager->ConfigureForSize(
outputType,
mColorSpace.refOr(
DefaultColorSpace({mImageSize.width, mImageSize.height})),
mColorRange, mVideoInfo.ImageRect().width,
mVideoInfo.ImageRect().height);
outputType, mColorSpace.refOr(gfx::YUVColorSpace::BT601),
mVideoInfo.ImageRect().width, mVideoInfo.ImageRect().height);
NS_ENSURE_TRUE(SUCCEEDED(hr),
MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
RESULT_DETAIL("Fail to configure image size for "
@ -765,7 +761,6 @@ WMFVideoMFTManager::Input(MediaRawData* aSample) {
// band, while for VP9 it's only available within the VP9 bytestream.
// The info would have been updated by the MediaChangeMonitor.
mColorSpace = Some(aSample->mTrackInfo->GetAsVideoInfo()->mColorSpace);
mColorRange = aSample->mTrackInfo->GetAsVideoInfo()->mColorRange;
}
mLastDuration = aSample->mDuration;
@ -934,10 +929,8 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample,
}
// YuvColorSpace
b.mYUVColorSpace =
mColorSpace.refOr(DefaultColorSpace({videoWidth, videoHeight}));
b.mYUVColorSpace = *mColorSpace;
b.mColorDepth = colorDepth;
b.mColorRange = mColorRange;
TimeUnit pts = GetSampleTime(aSample);
NS_ENSURE_TRUE(pts.IsValid(), E_FAIL);
@ -1049,11 +1042,8 @@ WMFVideoMFTManager::Output(int64_t aStreamOffset, RefPtr<MediaData>& aOutData) {
if (mUseHwAccel) {
hr = mDXVA2Manager->ConfigureForSize(
outputType,
mColorSpace.refOr(
DefaultColorSpace({mImageSize.width, mImageSize.height})),
mColorRange, mVideoInfo.ImageRect().width,
mVideoInfo.ImageRect().height);
outputType, mColorSpace.refOr(gfx::YUVColorSpace::BT601),
mVideoInfo.ImageRect().width, mVideoInfo.ImageRect().height);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
} else {
// The stride may have changed, recheck for it.

Просмотреть файл

@ -72,7 +72,6 @@ class WMFVideoMFTManager : public MFTManager {
gfx::IntSize mDecodedImageSize;
uint32_t mVideoStride;
Maybe<gfx::YUVColorSpace> mColorSpace;
gfx::ColorRange mColorRange;
RefPtr<layers::ImageContainer> mImageContainer;
RefPtr<layers::KnowsCompositor> mKnowsCompositor;

Просмотреть файл

@ -141,9 +141,7 @@ class H264ChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
gfx::IntRect(0, 0, spsdata.pic_width, spsdata.pic_height));
mCurrentConfig.mColorDepth = spsdata.ColorDepth();
mCurrentConfig.mColorSpace = spsdata.ColorSpace();
mCurrentConfig.mColorRange = spsdata.video_full_range_flag
? gfx::ColorRange::FULL
: gfx::ColorRange::LIMITED;
mCurrentConfig.mFullRange = spsdata.video_full_range_flag;
}
mCurrentConfig.mExtraData = aExtraData;
mTrackInfo = new TrackInfoSharedPtr(mCurrentConfig, mStreamID++);
@ -204,7 +202,7 @@ class VPXChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
// The AR data isn't found in the VP8/VP9 bytestream.
mCurrentConfig.mColorDepth = gfx::ColorDepthForBitDepth(info.mBitDepth);
mCurrentConfig.mColorSpace = info.ColorSpace();
mCurrentConfig.mColorRange = info.ColorRange();
mCurrentConfig.mFullRange = info.mFullRange;
mTrackInfo = new TrackInfoSharedPtr(mCurrentConfig, mStreamID++);
return rv;

Просмотреть файл

@ -230,7 +230,6 @@ static void AllocateSolidColorFrame(layers::PlanarYCbCrData& aData, int aWidth,
aData.mPicY = 0;
aData.mPicSize = IntSize(aWidth, aHeight);
aData.mStereoMode = StereoMode::MONO;
aData.mYUVColorSpace = gfx::YUVColorSpace::BT601;
}
static void ReleaseFrame(layers::PlanarYCbCrData& aData) {

Просмотреть файл

@ -588,7 +588,6 @@ int MediaEngineRemoteVideoSource::DeliverFrame(
data.mPicX = 0;
data.mPicY = 0;
data.mPicSize = IntSize(buffer->width(), buffer->height());
data.mYUVColorSpace = gfx::YUVColorSpace::BT601;
RefPtr<layers::PlanarYCbCrImage> image =
mImageContainer->CreatePlanarYCbCrImage();

Просмотреть файл

@ -8,10 +8,10 @@
#include <OpenGL/gl.h>
#include <QuartzCore/QuartzCore.h>
#include <dlfcn.h>
#include "mozilla/RefPtr.h"
#include "mozilla/Assertions.h"
#include "GLConsts.h"
#include "GLContextCGL.h"
#include "mozilla/Assertions.h"
#include "mozilla/RefPtr.h"
using namespace mozilla;
// IOSurface signatures
@ -295,7 +295,6 @@ MacIOSurface::~MacIOSurface() {
CFRelease(mIOSurfacePtr);
}
/* static */
already_AddRefed<MacIOSurface> MacIOSurface::CreateIOSurface(
int aWidth, int aHeight, double aContentsScaleFactor, bool aHasAlpha) {
if (!MacIOSurfaceLib::isInit() || aContentsScaleFactor <= 0) return nullptr;
@ -340,7 +339,6 @@ already_AddRefed<MacIOSurface> MacIOSurface::CreateIOSurface(
return ioSurface.forget();
}
/* static */
already_AddRefed<MacIOSurface> MacIOSurface::LookupSurface(
IOSurfaceID aIOSurfaceID, double aContentsScaleFactor, bool aHasAlpha,
gfx::YUVColorSpace aColorSpace) {
@ -358,30 +356,30 @@ already_AddRefed<MacIOSurface> MacIOSurface::LookupSurface(
return ioSurface.forget();
}
IOSurfaceID MacIOSurface::GetIOSurfaceID() const {
IOSurfaceID MacIOSurface::GetIOSurfaceID() {
return MacIOSurfaceLib::IOSurfaceGetID(mIOSurfacePtr);
}
void* MacIOSurface::GetBaseAddress() const {
void* MacIOSurface::GetBaseAddress() {
return MacIOSurfaceLib::IOSurfaceGetBaseAddress(mIOSurfacePtr);
}
void* MacIOSurface::GetBaseAddressOfPlane(size_t aPlaneIndex) const {
void* MacIOSurface::GetBaseAddressOfPlane(size_t aPlaneIndex) {
return MacIOSurfaceLib::IOSurfaceGetBaseAddressOfPlane(mIOSurfacePtr,
aPlaneIndex);
}
size_t MacIOSurface::GetWidth(size_t plane) const {
size_t MacIOSurface::GetWidth(size_t plane) {
size_t intScaleFactor = ceil(mContentsScaleFactor);
return GetDevicePixelWidth(plane) / intScaleFactor;
}
size_t MacIOSurface::GetHeight(size_t plane) const {
size_t MacIOSurface::GetHeight(size_t plane) {
size_t intScaleFactor = ceil(mContentsScaleFactor);
return GetDevicePixelHeight(plane) / intScaleFactor;
}
size_t MacIOSurface::GetPlaneCount() const {
size_t MacIOSurface::GetPlaneCount() {
return MacIOSurfaceLib::IOSurfaceGetPlaneCount(mIOSurfacePtr);
}
@ -399,19 +397,19 @@ size_t MacIOSurface::GetMaxHeight() {
MacIOSurfaceLib::kPropHeight);
}
size_t MacIOSurface::GetDevicePixelWidth(size_t plane) const {
size_t MacIOSurface::GetDevicePixelWidth(size_t plane) {
return MacIOSurfaceLib::IOSurfaceGetWidth(mIOSurfacePtr, plane);
}
size_t MacIOSurface::GetDevicePixelHeight(size_t plane) const {
size_t MacIOSurface::GetDevicePixelHeight(size_t plane) {
return MacIOSurfaceLib::IOSurfaceGetHeight(mIOSurfacePtr, plane);
}
size_t MacIOSurface::GetBytesPerRow(size_t plane) const {
size_t MacIOSurface::GetBytesPerRow(size_t plane) {
return MacIOSurfaceLib::IOSurfaceGetBytesPerRow(mIOSurfacePtr, plane);
}
OSType MacIOSurface::GetPixelFormat() const {
OSType MacIOSurface::GetPixelFormat() {
return MacIOSurfaceLib::IOSurfaceGetPixelFormat(mIOSurfacePtr);
}
@ -470,24 +468,22 @@ already_AddRefed<SourceSurface> MacIOSurface::GetAsSurface() {
return surf.forget();
}
SurfaceFormat MacIOSurface::GetFormat() const {
SurfaceFormat MacIOSurface::GetFormat() {
OSType pixelFormat = GetPixelFormat();
if (pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange ||
pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) {
if (pixelFormat == '420v') {
return SurfaceFormat::NV12;
} else if (pixelFormat == kCVPixelFormatType_422YpCbCr8) {
} else if (pixelFormat == '2vuy') {
return SurfaceFormat::YUV422;
} else {
return HasAlpha() ? SurfaceFormat::R8G8B8A8 : SurfaceFormat::R8G8B8X8;
}
}
SurfaceFormat MacIOSurface::GetReadFormat() const {
SurfaceFormat MacIOSurface::GetReadFormat() {
OSType pixelFormat = GetPixelFormat();
if (pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange ||
pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) {
if (pixelFormat == '420v') {
return SurfaceFormat::NV12;
} else if (pixelFormat == kCVPixelFormatType_422YpCbCr8) {
} else if (pixelFormat == '2vuy') {
return SurfaceFormat::R8G8B8X8;
} else {
return HasAlpha() ? SurfaceFormat::R8G8B8A8 : SurfaceFormat::R8G8B8X8;
@ -514,8 +510,7 @@ CGLError MacIOSurface::CGLTexImageIOSurface2D(
GLenum internalFormat;
GLenum format;
GLenum type;
if (pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange ||
pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) {
if (pixelFormat == '420v') {
MOZ_ASSERT(GetPlaneCount() == 2);
MOZ_ASSERT(plane < 2);
@ -533,7 +528,7 @@ CGLError MacIOSurface::CGLTexImageIOSurface2D(
if (aOutReadFormat) {
*aOutReadFormat = mozilla::gfx::SurfaceFormat::NV12;
}
} else if (pixelFormat == kCVPixelFormatType_422YpCbCr8) {
} else if (pixelFormat == '2vuy') {
MOZ_ASSERT(plane == 0);
// The YCBCR_422_APPLE ext is only available in compatibility profile. So,
// we should use RGB_422_APPLE for core profile. The difference between

Просмотреть файл

@ -7,8 +7,8 @@
#ifndef MacIOSurface_h__
#define MacIOSurface_h__
#ifdef XP_DARWIN
# include <CoreVideo/CoreVideo.h>
# include <QuartzCore/QuartzCore.h>
# include <CoreVideo/CoreVideo.h>
# include <dlfcn.h>
# include "mozilla/gfx/Types.h"
@ -70,8 +70,8 @@ typedef OSType (*IOSurfacePixelFormatFunc)(IOSurfacePtr io_surface);
# endif
# include "2D.h"
# include "mozilla/RefCounted.h"
# include "mozilla/RefPtr.h"
# include "mozilla/RefCounted.h"
enum CGContextType {
CG_CONTEXT_TYPE_UNKNOWN = 0,
@ -108,28 +108,28 @@ class MacIOSurface final
mozilla::gfx::YUVColorSpace aColorSpace =
mozilla::gfx::YUVColorSpace::UNKNOWN);
~MacIOSurface();
IOSurfaceID GetIOSurfaceID() const;
void* GetBaseAddress() const;
void* GetBaseAddressOfPlane(size_t planeIndex) const;
size_t GetPlaneCount() const;
OSType GetPixelFormat() const;
IOSurfaceID GetIOSurfaceID();
void* GetBaseAddress();
void* GetBaseAddressOfPlane(size_t planeIndex);
size_t GetPlaneCount();
OSType GetPixelFormat();
// GetWidth() and GetHeight() return values in "display pixels". A
// "display pixel" is the smallest fully addressable part of a display.
// But in HiDPI modes each "display pixel" corresponds to more than one
// device pixel. Use GetDevicePixel**() to get device pixels.
size_t GetWidth(size_t plane = 0) const;
size_t GetHeight(size_t plane = 0) const;
double GetContentsScaleFactor() const { return mContentsScaleFactor; }
size_t GetDevicePixelWidth(size_t plane = 0) const;
size_t GetDevicePixelHeight(size_t plane = 0) const;
size_t GetBytesPerRow(size_t plane = 0) const;
size_t GetWidth(size_t plane = 0);
size_t GetHeight(size_t plane = 0);
double GetContentsScaleFactor() { return mContentsScaleFactor; }
size_t GetDevicePixelWidth(size_t plane = 0);
size_t GetDevicePixelHeight(size_t plane = 0);
size_t GetBytesPerRow(size_t plane = 0);
void Lock(bool aReadOnly = true);
void Unlock(bool aReadOnly = true);
void IncrementUseCount();
void DecrementUseCount();
bool HasAlpha() const { return mHasAlpha; }
mozilla::gfx::SurfaceFormat GetFormat() const;
mozilla::gfx::SurfaceFormat GetReadFormat() const;
bool HasAlpha() { return mHasAlpha; }
mozilla::gfx::SurfaceFormat GetFormat();
mozilla::gfx::SurfaceFormat GetReadFormat();
// This would be better suited on MacIOSurfaceImage type, however due to the
// current data structure, this is not possible as only the IOSurfacePtr is
// being used across.
@ -137,9 +137,6 @@ class MacIOSurface final
mColorSpace = aColorSpace;
}
mozilla::gfx::YUVColorSpace GetYUVColorSpace() const { return mColorSpace; }
bool IsFullRange() const {
return GetPixelFormat() == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
}
// We would like to forward declare NSOpenGLContext, but it is an @interface
// and this file is also used from c++, so we use a void *.

Просмотреть файл

@ -156,12 +156,6 @@ enum class ColorDepth : uint8_t {
UNKNOWN
};
enum class ColorRange : uint8_t {
LIMITED,
FULL,
UNKNOWN
};
static inline SurfaceFormat SurfaceFormatForColorDepth(ColorDepth aColorDepth) {
SurfaceFormat format = SurfaceFormat::A8;
switch (aColorDepth) {

Просмотреть файл

@ -1008,7 +1008,7 @@ bool GLBlitHelper::BlitImage(layers::MacIOSurfaceImage* const srcImage,
return false;
}
if (pixelFormat == kCVPixelFormatType_422YpCbCr8) {
if (pixelFormat == '2vuy') {
fragBody = kFragBody_CrYCb;
// APPLE_rgb_422 adds RGB_RAW_422_APPLE for `internalFormat`, but only RGB
// seems to work?

Просмотреть файл

@ -151,8 +151,7 @@ bool SharedSurface_ANGLEShareHandle::ToSurfaceDescriptor(
gfx::SurfaceFormat format =
mHasAlpha ? gfx::SurfaceFormat::B8G8R8A8 : gfx::SurfaceFormat::B8G8R8X8;
*out_descriptor = layers::SurfaceDescriptorD3D10(
(WindowsHandle)mShareHandle, format, mSize, gfx::YUVColorSpace::UNKNOWN,
gfx::ColorRange::FULL);
(WindowsHandle)mShareHandle, format, mSize, gfx::YUVColorSpace::UNKNOWN);
return true;
}

Просмотреть файл

@ -467,8 +467,7 @@ bool SharedSurface_D3D11Interop::ToSurfaceDescriptor(
const auto format =
(mHasAlpha ? gfx::SurfaceFormat::B8G8R8A8 : gfx::SurfaceFormat::B8G8R8X8);
*out_descriptor = layers::SurfaceDescriptorD3D10(
WindowsHandle(mDXGIHandle), format, mSize, gfx::YUVColorSpace::UNKNOWN,
gfx::ColorRange::FULL);
WindowsHandle(mDXGIHandle), format, mSize, gfx::YUVColorSpace::UNKNOWN);
return true;
}

Просмотреть файл

@ -652,12 +652,6 @@ struct ParamTraits<mozilla::gfx::ColorDepth>
mozilla::gfx::ColorDepth::COLOR_8,
mozilla::gfx::ColorDepth::UNKNOWN> {};
template <>
struct ParamTraits<mozilla::gfx::ColorRange>
: public ContiguousEnumSerializer<mozilla::gfx::ColorRange,
mozilla::gfx::ColorRange::LIMITED,
mozilla::gfx::ColorRange::UNKNOWN> {};
template <>
struct ParamTraits<mozilla::gfx::YUVColorSpace>
: public ContiguousEnumSerializer<

Просмотреть файл

@ -155,7 +155,7 @@ BufferTextureData* BufferTextureData::CreateForYCbCr(
KnowsCompositor* aAllocator, gfx::IntSize aYSize, uint32_t aYStride,
gfx::IntSize aCbCrSize, uint32_t aCbCrStride, StereoMode aStereoMode,
gfx::ColorDepth aColorDepth, gfx::YUVColorSpace aYUVColorSpace,
gfx::ColorRange aColorRange, TextureFlags aTextureFlags) {
TextureFlags aTextureFlags) {
uint32_t bufSize = ImageDataSerializer::ComputeYCbCrBufferSize(
aYSize, aYStride, aCbCrSize, aCbCrStride);
if (bufSize == 0) {
@ -183,10 +183,9 @@ BufferTextureData* BufferTextureData::CreateForYCbCr(
supportsTextureDirectMapping)
: true;
YCbCrDescriptor descriptor =
YCbCrDescriptor(aYSize, aYStride, aCbCrSize, aCbCrStride, yOffset,
cbOffset, crOffset, aStereoMode, aColorDepth,
aYUVColorSpace, aColorRange, hasIntermediateBuffer);
YCbCrDescriptor descriptor = YCbCrDescriptor(
aYSize, aYStride, aCbCrSize, aCbCrStride, yOffset, cbOffset, crOffset,
aStereoMode, aColorDepth, aYUVColorSpace, hasIntermediateBuffer);
return CreateInternal(
aAllocator ? aAllocator->GetTextureForwarder() : nullptr, descriptor,

Просмотреть файл

@ -34,7 +34,7 @@ class BufferTextureData : public TextureData {
KnowsCompositor* aAllocator, gfx::IntSize aYSize, uint32_t aYStride,
gfx::IntSize aCbCrSize, uint32_t aCbCrStride, StereoMode aStereoMode,
gfx::ColorDepth aColorDepth, gfx::YUVColorSpace aYUVColorSpace,
gfx::ColorRange aColorRange, TextureFlags aTextureFlags);
TextureFlags aTextureFlags);
bool Lock(OpenMode aMode) override { return true; }

Просмотреть файл

@ -25,19 +25,16 @@ using namespace gfx;
D3D11ShareHandleImage::D3D11ShareHandleImage(const gfx::IntSize& aSize,
const gfx::IntRect& aRect,
gfx::YUVColorSpace aColorSpace,
gfx::ColorRange aColorRange)
gfx::YUVColorSpace aColorSpace)
: Image(nullptr, ImageFormat::D3D11_SHARE_HANDLE_TEXTURE),
mSize(aSize),
mPictureRect(aRect),
mYUVColorSpace(aColorSpace),
mColorRange(aColorRange) {}
mYUVColorSpace(aColorSpace) {}
bool D3D11ShareHandleImage::AllocateTexture(D3D11RecycleAllocator* aAllocator,
ID3D11Device* aDevice) {
if (aAllocator) {
mTextureClient =
aAllocator->CreateOrRecycleClient(mYUVColorSpace, mColorRange, mSize);
mTextureClient = aAllocator->CreateOrRecycleClient(mYUVColorSpace, mSize);
if (mTextureClient) {
D3D11TextureData* textureData = GetData();
MOZ_DIAGNOSTIC_ASSERT(textureData, "Wrong TextureDataType");
@ -180,7 +177,6 @@ class MOZ_RAII D3D11TextureClientAllocationHelper
public:
D3D11TextureClientAllocationHelper(gfx::SurfaceFormat aFormat,
gfx::YUVColorSpace aColorSpace,
gfx::ColorRange aColorRange,
const gfx::IntSize& aSize,
TextureAllocationFlags aAllocFlags,
ID3D11Device* aDevice,
@ -188,7 +184,6 @@ class MOZ_RAII D3D11TextureClientAllocationHelper
: ITextureClientAllocationHelper(aFormat, aSize, BackendSelector::Content,
aTextureFlags, aAllocFlags),
mYUVColorSpace(aColorSpace),
mColorRange(aColorRange),
mDevice(aDevice) {}
bool IsCompatible(TextureClient* aTextureClient) override {
@ -203,7 +198,6 @@ class MOZ_RAII D3D11TextureClientAllocationHelper
aTextureClient->GetFormat() != gfx::SurfaceFormat::P010 &&
aTextureClient->GetFormat() != gfx::SurfaceFormat::P016) ||
(textureData->GetYUVColorSpace() == mYUVColorSpace &&
textureData->GetColorRange() == mColorRange &&
textureData->GetTextureAllocationFlags() == mAllocationFlags);
}
@ -215,14 +209,12 @@ class MOZ_RAII D3D11TextureClientAllocationHelper
return nullptr;
}
data->SetYUVColorSpace(mYUVColorSpace);
data->SetColorRange(mColorRange);
return MakeAndAddRef<TextureClient>(data, mTextureFlags,
aAllocator->GetTextureForwarder());
}
private:
const gfx::YUVColorSpace mYUVColorSpace;
const gfx::ColorRange mColorRange;
gfx::YUVColorSpace mYUVColorSpace;
const RefPtr<ID3D11Device> mDevice;
};
@ -254,8 +246,7 @@ void D3D11RecycleAllocator::SetPreferredSurfaceFormat(
}
already_AddRefed<TextureClient> D3D11RecycleAllocator::CreateOrRecycleClient(
gfx::YUVColorSpace aColorSpace, gfx::ColorRange aColorRange,
const gfx::IntSize& aSize) {
gfx::YUVColorSpace aColorSpace, const gfx::IntSize& aSize) {
// When CompositorDevice or ContentDevice is updated,
// we could not reuse old D3D11Textures. It could cause video flickering.
RefPtr<ID3D11Device> device = gfx::DeviceManagerDx::Get()->GetImageDevice();
@ -272,9 +263,9 @@ already_AddRefed<TextureClient> D3D11RecycleAllocator::CreateOrRecycleClient(
allocFlags = TextureAllocationFlags::ALLOC_MANUAL_SYNCHRONIZATION;
}
D3D11TextureClientAllocationHelper helper(
mUsableSurfaceFormat, aColorSpace, aColorRange, aSize, allocFlags,
mDevice, layers::TextureFlags::DEFAULT);
D3D11TextureClientAllocationHelper helper(mUsableSurfaceFormat, aColorSpace,
aSize, allocFlags, mDevice,
layers::TextureFlags::DEFAULT);
RefPtr<TextureClient> textureClient = CreateOrRecycle(helper);
return textureClient.forget();

Просмотреть файл

@ -28,8 +28,7 @@ class D3D11RecycleAllocator final : public TextureClientRecycleAllocator {
gfx::SurfaceFormat aPreferredFormat);
already_AddRefed<TextureClient> CreateOrRecycleClient(
gfx::YUVColorSpace aColorSpace, gfx::ColorRange aColorRange,
const gfx::IntSize& aSize);
gfx::YUVColorSpace aColorSpace, const gfx::IntSize& aSize);
void SetPreferredSurfaceFormat(gfx::SurfaceFormat aPreferredFormat);
@ -52,8 +51,7 @@ class D3D11RecycleAllocator final : public TextureClientRecycleAllocator {
class D3D11ShareHandleImage final : public Image {
public:
D3D11ShareHandleImage(const gfx::IntSize& aSize, const gfx::IntRect& aRect,
gfx::YUVColorSpace aColorSpace,
gfx::ColorRange aColorRange);
gfx::YUVColorSpace aColorSpace);
virtual ~D3D11ShareHandleImage() = default;
bool AllocateTexture(D3D11RecycleAllocator* aAllocator,
@ -67,7 +65,6 @@ class D3D11ShareHandleImage final : public Image {
ID3D11Texture2D* GetTexture() const;
gfx::YUVColorSpace GetYUVColorSpace() const { return mYUVColorSpace; }
gfx::ColorRange GetColorRange() const { return mColorRange; }
private:
friend class gl::GLBlitHelper;
@ -81,7 +78,6 @@ class D3D11ShareHandleImage final : public Image {
gfx::IntSize mSize;
gfx::IntRect mPictureRect;
gfx::YUVColorSpace mYUVColorSpace;
gfx::ColorRange mColorRange;
RefPtr<TextureClient> mTextureClient;
RefPtr<ID3D11Texture2D> mTexture;
};

Просмотреть файл

@ -33,7 +33,6 @@ bool D3D11YCbCrImage::SetData(KnowsCompositor* aAllocator,
mCbCrSize = aData.mCbCrSize;
mColorDepth = aData.mColorDepth;
mColorSpace = aData.mYUVColorSpace;
mColorRange = aData.mColorRange;
D3D11YCbCrRecycleAllocator* allocator =
aContainer->GetD3D11YCbCrRecycleAllocator(aAllocator);
@ -233,7 +232,6 @@ already_AddRefed<SourceSurface> D3D11YCbCrImage::GetAsSourceSurface() {
data.mStereoMode = StereoMode::MONO;
data.mColorDepth = mColorDepth;
data.mYUVColorSpace = mColorSpace;
data.mColorRange = mColorRange;
data.mYSkip = data.mCbSkip = data.mCrSkip = 0;
data.mYSize = mYSize;
data.mCbCrSize = mCbCrSize;
@ -406,8 +404,7 @@ already_AddRefed<TextureClient> DXGIYCbCrTextureAllocationHelper::Allocate(
return TextureClient::CreateWithData(
DXGIYCbCrTextureData::Create(textureY, textureCb, textureCr, mData.mYSize,
mData.mYSize, mData.mCbCrSize,
mData.mColorDepth, mData.mYUVColorSpace,
mData.mColorRange),
mData.mColorDepth, mData.mYUVColorSpace),
mTextureFlags, forwarder);
}

Просмотреть файл

@ -80,7 +80,6 @@ class D3D11YCbCrImage : public Image {
gfx::IntRect mPictureRect;
gfx::ColorDepth mColorDepth;
gfx::YUVColorSpace mColorSpace;
gfx::ColorRange mColorRange;
RefPtr<TextureClient> mTextureClient;
};

Просмотреть файл

@ -85,8 +85,7 @@ bool DXGID3D9TextureData::Serialize(SurfaceDescriptor& aOutDescriptor) {
mFormat == SurfaceFormat::P010 || mFormat == SurfaceFormat::P016;
aOutDescriptor = SurfaceDescriptorD3D10(
(WindowsHandle)(mHandle), mFormat, GetSize(),
isYUV ? gfx::YUVColorSpace::BT601 : gfx::YUVColorSpace::UNKNOWN,
gfx::ColorRange::LIMITED);
isYUV ? gfx::YUVColorSpace::BT601 : gfx::YUVColorSpace::UNKNOWN);
return true;
}

Просмотреть файл

@ -140,26 +140,21 @@ struct EffectRGB : public TexturedEffect {
struct EffectYCbCr : public TexturedEffect {
EffectYCbCr(TextureSource* aSource, gfx::YUVColorSpace aYUVColorSpace,
gfx::ColorRange aColorRange, gfx::ColorDepth aColorDepth,
gfx::SamplingFilter aSamplingFilter)
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::ColorRange aColorRange, gfx::ColorDepth aColorDepth,
gfx::SamplingFilter aSamplingFilter)
: EffectYCbCr(aSource, aYUVColorSpace, aColorRange, aColorDepth,
aSamplingFilter) {
gfx::ColorDepth aColorDepth, gfx::SamplingFilter aSamplingFilter)
: EffectYCbCr(aSource, aYUVColorSpace, aColorDepth, aSamplingFilter) {
mType = EffectTypes::NV12;
}
@ -248,15 +243,13 @@ inline already_AddRefed<TexturedEffect> CreateTexturedEffect(
case gfx::SurfaceFormat::YUV:
MOZ_ASSERT(aHost->GetYUVColorSpace() != gfx::YUVColorSpace::UNKNOWN);
result = new EffectYCbCr(aSource, aHost->GetYUVColorSpace(),
aHost->GetColorRange(), aHost->GetColorDepth(),
aSamplingFilter);
aHost->GetColorDepth(), aSamplingFilter);
break;
case gfx::SurfaceFormat::NV12:
case gfx::SurfaceFormat::P010:
case gfx::SurfaceFormat::P016:
result = new EffectNV12(aSource, aHost->GetYUVColorSpace(),
aHost->GetColorRange(), aHost->GetColorDepth(),
aSamplingFilter);
aHost->GetColorDepth(), aSamplingFilter);
break;
default:
result = CreateTexturedEffect(aHost->GetReadFormat(), aSource,

Просмотреть файл

@ -453,7 +453,7 @@ nsresult PlanarYCbCrImage::BuildSurfaceDescriptorBuffer(
aSdBuffer.desc() = YCbCrDescriptor(
pdata->mYSize, pdata->mYStride, pdata->mCbCrSize, pdata->mCbCrStride,
yOffset, cbOffset, crOffset, pdata->mStereoMode, pdata->mColorDepth,
pdata->mYUVColorSpace, pdata->mColorRange,
pdata->mYUVColorSpace,
/*hasIntermediateBuffer*/ false);
uint8_t* buffer = nullptr;

Просмотреть файл

@ -716,29 +716,46 @@ class AutoLockImage {
struct PlanarYCbCrData {
// Luminance buffer
uint8_t* mYChannel = nullptr;
int32_t mYStride = 0;
gfx::IntSize mYSize = gfx::IntSize(0, 0);
int32_t mYSkip = 0;
uint8_t* mYChannel;
int32_t mYStride;
gfx::IntSize mYSize;
int32_t mYSkip;
// Chroma buffers
uint8_t* mCbChannel = nullptr;
uint8_t* mCrChannel = nullptr;
int32_t mCbCrStride = 0;
gfx::IntSize mCbCrSize = gfx::IntSize(0, 0);
int32_t mCbSkip = 0;
int32_t mCrSkip = 0;
uint8_t* mCbChannel;
uint8_t* mCrChannel;
int32_t mCbCrStride;
gfx::IntSize mCbCrSize;
int32_t mCbSkip;
int32_t mCrSkip;
// Picture region
uint32_t mPicX = 0;
uint32_t mPicY = 0;
gfx::IntSize mPicSize = gfx::IntSize(0, 0);
StereoMode mStereoMode = StereoMode::MONO;
gfx::ColorDepth mColorDepth = gfx::ColorDepth::COLOR_8;
gfx::YUVColorSpace mYUVColorSpace = gfx::YUVColorSpace::UNKNOWN;
gfx::ColorRange mColorRange = gfx::ColorRange::LIMITED;
uint32_t mPicX;
uint32_t mPicY;
gfx::IntSize mPicSize;
StereoMode mStereoMode;
gfx::YUVColorSpace mYUVColorSpace;
gfx::ColorDepth mColorDepth;
gfx::IntRect GetPictureRect() const {
return gfx::IntRect(mPicX, mPicY, mPicSize.width, mPicSize.height);
}
PlanarYCbCrData()
: mYChannel(nullptr),
mYStride(0),
mYSize(0, 0),
mYSkip(0),
mCbChannel(nullptr),
mCrChannel(nullptr),
mCbCrStride(0),
mCbCrSize(0, 0),
mCbSkip(0),
mCrSkip(0),
mPicX(0),
mPicY(0),
mPicSize(0, 0),
mStereoMode(StereoMode::MONO),
mYUVColorSpace(gfx::YUVColorSpace::BT601),
mColorDepth(gfx::ColorDepth::COLOR_8) {}
};
/****** Image subtypes for the different formats ******/

Просмотреть файл

@ -182,18 +182,6 @@ Maybe<gfx::ColorDepth> ColorDepthFromBufferDescriptor(
}
}
Maybe<gfx::ColorRange> ColorRangeFromBufferDescriptor(
const BufferDescriptor& aDescriptor) {
switch (aDescriptor.type()) {
case BufferDescriptor::TRGBDescriptor:
return Nothing();
case BufferDescriptor::TYCbCrDescriptor:
return Some(aDescriptor.get_YCbCrDescriptor().colorRange());
default:
MOZ_CRASH("GFX: YUVFullRangeFromBufferDescriptor");
}
}
Maybe<StereoMode> StereoModeFromBufferDescriptor(
const BufferDescriptor& aDescriptor) {
switch (aDescriptor.type()) {

Просмотреть файл

@ -66,9 +66,6 @@ Maybe<gfx::YUVColorSpace> YUVColorSpaceFromBufferDescriptor(
Maybe<gfx::ColorDepth> ColorDepthFromBufferDescriptor(
const BufferDescriptor& aDescriptor);
Maybe<gfx::ColorRange> ColorRangeFromBufferDescriptor(
const BufferDescriptor& aDescriptor);
Maybe<StereoMode> StereoModeFromBufferDescriptor(
const BufferDescriptor& aDescriptor);

Просмотреть файл

@ -83,9 +83,6 @@ CreateSourceSurfaceFromLockedMacIOSurface(MacIOSurface* aSurface) {
data.mCbCrStride = cbCrWidth;
data.mCbCrSize = IntSize::Truncate(cbCrWidth, cbCrHeight);
data.mPicSize = data.mYSize;
data.mYUVColorSpace = aSurface->GetYUVColorSpace();
data.mColorRange = aSurface->IsFullRange() ? gfx::ColorRange::FULL
: gfx::ColorRange::LIMITED;
ConvertYCbCrToRGB(data, SurfaceFormat::B8G8R8X8,
IntSize::Truncate(ioWidth, ioHeight), mappedSurface.mData,
@ -150,9 +147,6 @@ CreateSourceSurfaceFromLockedMacIOSurface(MacIOSurface* aSurface) {
data.mCbCrStride = cbCrStride;
data.mCbCrSize = IntSize::Truncate(cbCrWidth, cbCrHeight);
data.mPicSize = data.mYSize;
data.mYUVColorSpace = aSurface->GetYUVColorSpace();
data.mColorRange = aSurface->IsFullRange() ? gfx::ColorRange::FULL
: gfx::ColorRange::LIMITED;
ConvertYCbCrToRGB(data, SurfaceFormat::B8G8R8X8,
IntSize::Truncate(ioWidth, ioHeight),

Просмотреть файл

@ -54,13 +54,15 @@ class MacIOSurfaceTextureHostBasic : public TextureHost {
MacIOSurfaceTextureHostBasic(
TextureFlags aFlags, const SurfaceDescriptorMacIOSurface& aDescriptor);
void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
virtual void SetTextureSourceProvider(
TextureSourceProvider* aProvider) override;
bool Lock() override;
gfx::SurfaceFormat GetFormat() const override;
bool BindTextureSource(CompositableTextureSourceRef& aTexture) override {
virtual bool BindTextureSource(
CompositableTextureSourceRef& aTexture) override {
aTexture = mTextureSource;
return !!aTexture;
}

Просмотреть файл

@ -102,7 +102,7 @@ already_AddRefed<TextureClient> ImageClient::CreateTextureClientForImage(
texture = TextureClient::CreateForYCbCr(
aKnowsCompositor, data->mYSize, data->mYStride, data->mCbCrSize,
data->mCbCrStride, data->mStereoMode, data->mColorDepth,
data->mYUVColorSpace, data->mColorRange, TextureFlags::DEFAULT);
data->mYUVColorSpace, TextureFlags::DEFAULT);
if (!texture) {
return nullptr;
}

Просмотреть файл

@ -1335,7 +1335,7 @@ already_AddRefed<TextureClient> TextureClient::CreateForYCbCr(
KnowsCompositor* aAllocator, gfx::IntSize aYSize, uint32_t aYStride,
gfx::IntSize aCbCrSize, uint32_t aCbCrStride, StereoMode aStereoMode,
gfx::ColorDepth aColorDepth, gfx::YUVColorSpace aYUVColorSpace,
gfx::ColorRange aColorRange, TextureFlags aTextureFlags) {
TextureFlags aTextureFlags) {
if (!aAllocator || !aAllocator->GetLayersIPCActor()->IPCOpen()) {
return nullptr;
}
@ -1346,7 +1346,7 @@ already_AddRefed<TextureClient> TextureClient::CreateForYCbCr(
TextureData* data = BufferTextureData::CreateForYCbCr(
aAllocator, aYSize, aYStride, aCbCrSize, aCbCrStride, aStereoMode,
aColorDepth, aYUVColorSpace, aColorRange, aTextureFlags);
aColorDepth, aYUVColorSpace, aTextureFlags);
if (!data) {
return nullptr;
}

Просмотреть файл

@ -365,7 +365,7 @@ class TextureClient : public AtomicRefCountedWithFinalize<TextureClient> {
KnowsCompositor* aAllocator, gfx::IntSize aYSize, uint32_t aYStride,
gfx::IntSize aCbCrSize, uint32_t aCbCrStride, StereoMode aStereoMode,
gfx::ColorDepth aColorDepth, gfx::YUVColorSpace aYUVColorSpace,
gfx::ColorRange aColorRange, TextureFlags aTextureFlags);
TextureFlags aTextureFlags);
// Creates and allocates a TextureClient (can be accessed through raw
// pointers).

Просмотреть файл

@ -96,10 +96,10 @@ bool YCbCrTextureClientAllocationHelper::IsCompatible(
already_AddRefed<TextureClient> YCbCrTextureClientAllocationHelper::Allocate(
KnowsCompositor* aAllocator) {
return TextureClient::CreateForYCbCr(
aAllocator, mData.mYSize, mData.mYStride, mData.mCbCrSize,
mData.mCbCrStride, mData.mStereoMode, mData.mColorDepth,
mData.mYUVColorSpace, mData.mColorRange, mTextureFlags);
return TextureClient::CreateForYCbCr(aAllocator, mData.mYSize, mData.mYStride,
mData.mCbCrSize, mData.mCbCrStride,
mData.mStereoMode, mData.mColorDepth,
mData.mYUVColorSpace, mTextureFlags);
}
TextureClientRecycleAllocator::TextureClientRecycleAllocator(

Просмотреть файл

@ -85,13 +85,6 @@ gfx::YUVColorSpace GPUVideoTextureHost::GetYUVColorSpace() const {
return gfx::YUVColorSpace::UNKNOWN;
}
gfx::ColorRange GPUVideoTextureHost::GetColorRange() const {
if (mWrappedTextureHost) {
return mWrappedTextureHost->GetColorRange();
}
return TextureHost::GetColorRange();
}
gfx::IntSize GPUVideoTextureHost::GetSize() const {
if (!mWrappedTextureHost) {
return gfx::IntSize();

Просмотреть файл

@ -38,7 +38,6 @@ class GPUVideoTextureHost : public TextureHost {
}
gfx::YUVColorSpace GetYUVColorSpace() const override;
gfx::ColorRange GetColorRange() const override;
gfx::IntSize GetSize() const override;

Просмотреть файл

@ -628,8 +628,7 @@ void BufferTextureHost::PushDisplayItems(
aBuilder.PushYCbCrPlanarImage(
aBounds, aClip, true, aImageKeys[0], aImageKeys[1], aImageKeys[2],
wr::ToWrColorDepth(desc.colorDepth()),
wr::ToWrYuvColorSpace(desc.yUVColorSpace()),
wr::ToWrColorRange(desc.colorRange()), aFilter);
wr::ToWrYuvColorSpace(desc.yUVColorSpace()), aFilter);
}
}
@ -896,14 +895,6 @@ gfx::ColorDepth BufferTextureHost::GetColorDepth() const {
return gfx::ColorDepth::COLOR_8;
}
gfx::ColorRange BufferTextureHost::GetColorRange() const {
if (mFormat == gfx::SurfaceFormat::YUV) {
const YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor();
return desc.colorRange();
}
return TextureHost::GetColorRange();
}
bool BufferTextureHost::UploadIfNeeded() {
return MaybeUpload(!mNeedsFullUpdate ? &mMaybeUpdatedRegion : nullptr);
}

Просмотреть файл

@ -447,14 +447,6 @@ class TextureHost : public AtomicRefCountedWithFinalize<TextureHost> {
return gfx::ColorDepth::COLOR_8;
}
/**
* Return true if using full range values (0-255 if 8 bits YUV). Used with YUV
* textures.
*/
virtual gfx::ColorRange GetColorRange() const {
return gfx::ColorRange::LIMITED;
}
/**
* Called during the transaction. The TextureSource may or may not be
* composited.
@ -772,8 +764,6 @@ class BufferTextureHost : public TextureHost {
gfx::ColorDepth GetColorDepth() const override;
gfx::ColorRange GetColorRange() const override;
gfx::IntSize GetSize() const override { return mSize; }
already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;

Просмотреть файл

@ -384,7 +384,7 @@ bool D3D11TextureData::SerializeSpecific(
}
*aOutDesc = SurfaceDescriptorD3D10((WindowsHandle)sharedHandle, mFormat,
mSize, mYUVColorSpace, mColorRange);
mSize, mYUVColorSpace);
return true;
}
@ -572,7 +572,7 @@ DXGIYCbCrTextureData* DXGIYCbCrTextureData::Create(
IDirect3DTexture9* aTextureCr, HANDLE aHandleY, HANDLE aHandleCb,
HANDLE aHandleCr, const gfx::IntSize& aSize, const gfx::IntSize& aSizeY,
const gfx::IntSize& aSizeCbCr, gfx::ColorDepth aColorDepth,
YUVColorSpace aYUVColorSpace, gfx::ColorRange aColorRange) {
YUVColorSpace aYUVColorSpace) {
if (!aHandleY || !aHandleCb || !aHandleCr || !aTextureY || !aTextureCb ||
!aTextureCr) {
return nullptr;
@ -590,7 +590,6 @@ DXGIYCbCrTextureData* DXGIYCbCrTextureData::Create(
texture->mSizeCbCr = aSizeCbCr;
texture->mColorDepth = aColorDepth;
texture->mYUVColorSpace = aYUVColorSpace;
texture->mColorRange = aColorRange;
return texture;
}
@ -599,8 +598,7 @@ DXGIYCbCrTextureData* DXGIYCbCrTextureData::Create(
ID3D11Texture2D* aTextureY, ID3D11Texture2D* aTextureCb,
ID3D11Texture2D* aTextureCr, const gfx::IntSize& aSize,
const gfx::IntSize& aSizeY, const gfx::IntSize& aSizeCbCr,
gfx::ColorDepth aColorDepth, YUVColorSpace aYUVColorSpace,
gfx::ColorRange aColorRange) {
gfx::ColorDepth aColorDepth, YUVColorSpace aYUVColorSpace) {
if (!aTextureY || !aTextureCb || !aTextureCr) {
return nullptr;
}
@ -652,7 +650,6 @@ DXGIYCbCrTextureData* DXGIYCbCrTextureData::Create(
texture->mSizeCbCr = aSizeCbCr;
texture->mColorDepth = aColorDepth;
texture->mYUVColorSpace = aYUVColorSpace;
texture->mColorRange = aColorRange;
return texture;
}
@ -670,7 +667,7 @@ void DXGIYCbCrTextureData::SerializeSpecific(
*aOutDesc = SurfaceDescriptorDXGIYCbCr(
(WindowsHandle)mHandles[0], (WindowsHandle)mHandles[1],
(WindowsHandle)mHandles[2], mSize, mSizeY, mSizeCbCr, mColorDepth,
mYUVColorSpace, mColorRange);
mYUVColorSpace);
}
bool DXGIYCbCrTextureData::Serialize(SurfaceDescriptor& aOutDescriptor) {
@ -765,7 +762,6 @@ DXGITextureHostD3D11::DXGITextureHostD3D11(
mHandle(aDescriptor.handle()),
mFormat(aDescriptor.format()),
mYUVColorSpace(aDescriptor.yUVColorSpace()),
mColorRange(aDescriptor.colorRange()),
mIsLocked(false) {}
bool DXGITextureHostD3D11::EnsureTexture() {
@ -1080,8 +1076,7 @@ void DXGITextureHostD3D11::PushDisplayItems(
GetFormat() == gfx::SurfaceFormat::NV12
? wr::ColorDepth::Color8
: wr::ColorDepth::Color16,
wr::ToWrYuvColorSpace(mYUVColorSpace),
wr::ToWrColorRange(mColorRange), aFilter);
wr::ToWrYuvColorSpace(mYUVColorSpace), aFilter);
break;
}
default: {
@ -1097,8 +1092,7 @@ DXGIYCbCrTextureHostD3D11::DXGIYCbCrTextureHostD3D11(
mSizeCbCr(aDescriptor.sizeCbCr()),
mIsLocked(false),
mColorDepth(aDescriptor.colorDepth()),
mYUVColorSpace(aDescriptor.yUVColorSpace()),
mColorRange(aDescriptor.colorRange()) {
mYUVColorSpace(aDescriptor.yUVColorSpace()) {
mHandles[0] = aDescriptor.handleY();
mHandles[1] = aDescriptor.handleCb();
mHandles[2] = aDescriptor.handleCr();
@ -1291,10 +1285,10 @@ void DXGIYCbCrTextureHostD3D11::PushDisplayItems(
const Range<wr::ImageKey>& aImageKeys) {
MOZ_ASSERT(aImageKeys.length() == 3);
aBuilder.PushYCbCrPlanarImage(
aBounds, aClip, true, aImageKeys[0], aImageKeys[1], aImageKeys[2],
wr::ToWrColorDepth(mColorDepth), wr::ToWrYuvColorSpace(mYUVColorSpace),
wr::ToWrColorRange(mColorRange), aFilter);
aBuilder.PushYCbCrPlanarImage(aBounds, aClip, true, aImageKeys[0],
aImageKeys[1], aImageKeys[2],
wr::ToWrColorDepth(mColorDepth),
wr::ToWrYuvColorSpace(mYUVColorSpace), aFilter);
}
bool DXGIYCbCrTextureHostD3D11::AcquireTextureSource(

Просмотреть файл

@ -87,8 +87,6 @@ class D3D11TextureData final : public TextureData {
void SetYUVColorSpace(gfx::YUVColorSpace aColorSpace) {
mYUVColorSpace = aColorSpace;
}
gfx::ColorRange GetColorRange() const { return mColorRange; }
void SetColorRange(gfx::ColorRange aColorRange) { mColorRange = aColorRange; }
gfx::IntSize GetSize() const { return mSize; }
gfx::SurfaceFormat GetSurfaceFormat() const { return mFormat; }
@ -119,7 +117,6 @@ class D3D11TextureData final : public TextureData {
gfx::IntSize mSize;
gfx::SurfaceFormat mFormat;
gfx::YUVColorSpace mYUVColorSpace = gfx::YUVColorSpace::UNKNOWN;
gfx::ColorRange mColorRange = gfx::ColorRange::LIMITED;
bool mNeedsClear;
bool mNeedsClearWhite;
bool mHasSynchronization;
@ -138,14 +135,13 @@ class DXGIYCbCrTextureData : public TextureData {
IDirect3DTexture9* aTextureCr, HANDLE aHandleY, HANDLE aHandleCb,
HANDLE aHandleCr, const gfx::IntSize& aSize, const gfx::IntSize& aSizeY,
const gfx::IntSize& aSizeCbCr, gfx::ColorDepth aColorDepth,
gfx::YUVColorSpace aYUVColorSpace, gfx::ColorRange aColorRange);
gfx::YUVColorSpace aYUVColorSpace);
static DXGIYCbCrTextureData* Create(
ID3D11Texture2D* aTextureCb, ID3D11Texture2D* aTextureY,
ID3D11Texture2D* aTextureCr, const gfx::IntSize& aSize,
const gfx::IntSize& aSizeY, const gfx::IntSize& aSizeCbCr,
gfx::ColorDepth aColorDepth, gfx::YUVColorSpace aYUVColorSpace,
gfx::ColorRange aColorRange);
gfx::ColorDepth aColorDepth, gfx::YUVColorSpace aYUVColorSpace);
bool Lock(OpenMode) override { return true; }
@ -174,8 +170,8 @@ class DXGIYCbCrTextureData : public TextureData {
gfx::IntSize GetCbCrSize() const { return mSizeCbCr; }
gfx::ColorDepth GetColorDepth() const { return mColorDepth; }
gfx::YUVColorSpace GetYUVColorSpace() const { return mYUVColorSpace; }
gfx::ColorRange GetColorRange() const { return mColorRange; }
ID3D11Texture2D* GetD3D11Texture(size_t index) {
return mD3D11Textures[index];
@ -190,7 +186,6 @@ class DXGIYCbCrTextureData : public TextureData {
gfx::IntSize mSizeCbCr;
gfx::ColorDepth mColorDepth;
gfx::YUVColorSpace mYUVColorSpace;
gfx::ColorRange mColorRange;
};
/**
@ -341,7 +336,6 @@ class DXGITextureHostD3D11 : public TextureHost {
gfx::YUVColorSpace GetYUVColorSpace() const override {
return mYUVColorSpace;
}
gfx::ColorRange GetColorRange() const override { return mColorRange; }
already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
@ -377,7 +371,6 @@ class DXGITextureHostD3D11 : public TextureHost {
WindowsHandle mHandle;
gfx::SurfaceFormat mFormat;
const gfx::YUVColorSpace mYUVColorSpace;
const gfx::ColorRange mColorRange;
bool mIsLocked;
};
@ -398,10 +391,10 @@ class DXGIYCbCrTextureHostD3D11 : public TextureHost {
}
gfx::ColorDepth GetColorDepth() const override { return mColorDepth; }
gfx::YUVColorSpace GetYUVColorSpace() const override {
return mYUVColorSpace;
}
gfx::ColorRange GetColorRange() const override { return mColorRange; }
bool Lock() override;
@ -445,7 +438,6 @@ class DXGIYCbCrTextureHostD3D11 : public TextureHost {
bool mIsLocked;
gfx::ColorDepth mColorDepth;
gfx::YUVColorSpace mYUVColorSpace;
gfx::ColorRange mColorRange;
};
class CompositingRenderTargetD3D11 : public CompositingRenderTarget,

Просмотреть файл

@ -10,7 +10,6 @@ using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
using mozilla::gfx::YUVColorSpace from "mozilla/gfx/Types.h";
using mozilla::gfx::ColorDepth from "mozilla/gfx/Types.h";
using mozilla::gfx::ColorRange from "mozilla/gfx/Types.h";
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
@ -36,7 +35,6 @@ struct SurfaceDescriptorD3D10 {
SurfaceFormat format;
IntSize size;
YUVColorSpace yUVColorSpace;
ColorRange colorRange;
};
struct SurfaceDescriptorDXGIYCbCr {
@ -48,7 +46,6 @@ struct SurfaceDescriptorDXGIYCbCr {
IntSize sizeCbCr;
ColorDepth colorDepth;
YUVColorSpace yUVColorSpace;
ColorRange colorRange;
};
struct SurfaceDescriptorMacIOSurface {
@ -110,7 +107,6 @@ struct YCbCrDescriptor {
StereoMode stereoMode;
ColorDepth colorDepth;
YUVColorSpace yUVColorSpace;
ColorRange colorRange;
bool hasIntermediateBuffer;
};

Просмотреть файл

@ -122,14 +122,6 @@ gfx::YUVColorSpace MacIOSurfaceTextureHostOGL::GetYUVColorSpace() const {
return mSurface->GetYUVColorSpace();
}
gfx::ColorRange MacIOSurfaceTextureHostOGL::GetColorRange() const {
if (!mSurface) {
return gfx::ColorRange::LIMITED;
}
return mSurface->IsFullRange() ? gfx::ColorRange::FULL
: gfx::ColorRange::LIMITED;
}
void MacIOSurfaceTextureHostOGL::CreateRenderTexture(
const wr::ExternalImageId& aExternalImageId) {
RefPtr<wr::RenderTextureHost> texture =
@ -237,8 +229,7 @@ void MacIOSurfaceTextureHostOGL::PushDisplayItems(
// which only supports 8 bits color depth.
aBuilder.PushYCbCrInterleavedImage(
aBounds, aClip, true, aImageKeys[0], wr::ColorDepth::Color8,
wr::ToWrYuvColorSpace(GetYUVColorSpace()),
wr::ToWrColorRange(GetColorRange()), aFilter);
wr::ToWrYuvColorSpace(GetYUVColorSpace()), aFilter);
break;
}
case gfx::SurfaceFormat::NV12: {
@ -249,7 +240,7 @@ void MacIOSurfaceTextureHostOGL::PushDisplayItems(
aBuilder.PushNV12Image(aBounds, aClip, true, aImageKeys[0], aImageKeys[1],
wr::ColorDepth::Color8,
wr::ToWrYuvColorSpace(GetYUVColorSpace()),
wr::ToWrColorRange(GetColorRange()), aFilter);
aFilter);
break;
}
default: {

Просмотреть файл

@ -79,7 +79,6 @@ class MacIOSurfaceTextureHostOGL : public TextureHost {
const Range<wr::ImageKey>& aImageKeys) override;
gfx::YUVColorSpace GetYUVColorSpace() const override;
gfx::ColorRange GetColorRange() const override;
protected:
GLTextureSource* CreateTextureSourceForPlane(size_t aPlane);

Просмотреть файл

@ -142,13 +142,6 @@ gfx::YUVColorSpace WebRenderTextureHost::GetYUVColorSpace() const {
return gfx::YUVColorSpace::UNKNOWN;
}
gfx::ColorRange WebRenderTextureHost::GetColorRange() const {
if (mWrappedTextureHost) {
return mWrappedTextureHost->GetColorRange();
}
return TextureHost::GetColorRange();
}
gfx::IntSize WebRenderTextureHost::GetSize() const {
if (!mWrappedTextureHost) {
return gfx::IntSize();

Просмотреть файл

@ -52,7 +52,6 @@ class WebRenderTextureHost : public TextureHost {
already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
gfx::YUVColorSpace GetYUVColorSpace() const override;
gfx::ColorRange GetColorRange() const override;
gfx::IntSize GetSize() const override;

Просмотреть файл

@ -297,9 +297,8 @@ TEST(Layers, TextureYCbCrSerialization)
RefPtr<TextureClient> client = TextureClient::CreateForYCbCr(
imageBridge, clientData.mYSize, clientData.mYStride, clientData.mCbCrSize,
clientData.mCbCrStride, StereoMode::MONO, ColorDepth::COLOR_8,
YUVColorSpace::BT601, ColorRange::LIMITED,
TextureFlags::DEALLOCATE_CLIENT);
clientData.mCbCrStride, StereoMode::MONO, gfx::ColorDepth::COLOR_8,
YUVColorSpace::BT601, TextureFlags::DEALLOCATE_CLIENT);
TestTextureClientYCbCr(client, clientData);

Просмотреть файл

@ -64,8 +64,7 @@ static already_AddRefed<TextureClient> CreateYCbCrTextureClientWithBackend(
return TextureClient::CreateForYCbCr(
nullptr, clientData.mYSize, clientData.mYStride, clientData.mCbCrSize,
clientData.mCbCrStride, StereoMode::MONO, gfx::ColorDepth::COLOR_8,
gfx::YUVColorSpace::BT601, gfx::ColorRange::LIMITED,
TextureFlags::DEALLOCATE_CLIENT);
YUVColorSpace::BT601, TextureFlags::DEALLOCATE_CLIENT);
}
#ifdef XP_WIN

Просмотреть файл

@ -1073,34 +1073,33 @@ void DisplayListBuilder::PushYCbCrPlanarImage(
bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1, wr::ImageKey aImageChannel2,
wr::WrColorDepth aColorDepth, wr::WrYuvColorSpace aColorSpace,
wr::WrColorRange aColorRange, wr::ImageRendering aRendering) {
wr_dp_push_yuv_planar_image(
mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
&mCurrentSpaceAndClipChain, aImageChannel0, aImageChannel1,
aImageChannel2, aColorDepth, aColorSpace, aColorRange, aRendering);
wr::ImageRendering aRendering) {
wr_dp_push_yuv_planar_image(mWrState, aBounds, MergeClipLeaf(aClip),
aIsBackfaceVisible, &mCurrentSpaceAndClipChain,
aImageChannel0, aImageChannel1, aImageChannel2,
aColorDepth, aColorSpace, aRendering);
}
void DisplayListBuilder::PushNV12Image(
const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1, wr::WrColorDepth aColorDepth,
wr::WrYuvColorSpace aColorSpace, wr::WrColorRange aColorRange,
wr::ImageRendering aRendering) {
wr::WrYuvColorSpace aColorSpace, wr::ImageRendering aRendering) {
wr_dp_push_yuv_NV12_image(mWrState, aBounds, MergeClipLeaf(aClip),
aIsBackfaceVisible, &mCurrentSpaceAndClipChain,
aImageChannel0, aImageChannel1, aColorDepth,
aColorSpace, aColorRange, aRendering);
aColorSpace, aRendering);
}
void DisplayListBuilder::PushYCbCrInterleavedImage(
const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
wr::WrColorDepth aColorDepth, wr::WrYuvColorSpace aColorSpace,
wr::WrColorRange aColorRange, wr::ImageRendering aRendering) {
wr_dp_push_yuv_interleaved_image(
mWrState, aBounds, MergeClipLeaf(aClip), aIsBackfaceVisible,
&mCurrentSpaceAndClipChain, aImageChannel0, aColorDepth, aColorSpace,
aColorRange, aRendering);
wr::ImageRendering aRendering) {
wr_dp_push_yuv_interleaved_image(mWrState, aBounds, MergeClipLeaf(aClip),
aIsBackfaceVisible,
&mCurrentSpaceAndClipChain, aImageChannel0,
aColorDepth, aColorSpace, aRendering);
}
void DisplayListBuilder::PushIFrame(const wr::LayoutRect& aBounds,

Просмотреть файл

@ -476,19 +476,21 @@ class DisplayListBuilder final {
bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1, wr::ImageKey aImageChannel2,
wr::WrColorDepth aColorDepth, wr::WrYuvColorSpace aColorSpace,
wr::WrColorRange aColorRange, wr::ImageRendering aFilter);
wr::ImageRendering aFilter);
void PushNV12Image(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
wr::ImageKey aImageChannel1, wr::WrColorDepth aColorDepth,
wr::WrYuvColorSpace aColorSpace,
wr::WrColorRange aColorRange, wr::ImageRendering aFilter);
wr::ImageRendering aFilter);
void PushYCbCrInterleavedImage(
const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip,
bool aIsBackfaceVisible, wr::ImageKey aImageChannel0,
wr::WrColorDepth aColorDepth, wr::WrYuvColorSpace aColorSpace,
wr::WrColorRange aColorRange, wr::ImageRendering aFilter);
void PushYCbCrInterleavedImage(const wr::LayoutRect& aBounds,
const wr::LayoutRect& aClip,
bool aIsBackfaceVisible,
wr::ImageKey aImageChannel0,
wr::WrColorDepth aColorDepth,
wr::WrYuvColorSpace aColorSpace,
wr::ImageRendering aFilter);
void PushIFrame(const wr::LayoutRect& aBounds, bool aIsBackfaceVisible,
wr::PipelineId aPipeline, bool aIgnoreMissingPipeline);

Просмотреть файл

@ -910,18 +910,6 @@ static inline wr::WrColorDepth ToWrColorDepth(gfx::ColorDepth aColorDepth) {
return wr::WrColorDepth::Color8;
}
static inline wr::WrColorRange ToWrColorRange(gfx::ColorRange aColorRange) {
switch (aColorRange) {
case gfx::ColorRange::LIMITED:
return wr::WrColorRange::Limited;
case gfx::ColorRange::FULL:
return wr::WrColorRange::Full;
default:
MOZ_ASSERT_UNREACHABLE("Tried to convert invalid color range value.");
return wr ::WrColorRange::Limited;
}
}
static inline wr::SyntheticItalics DegreesToSyntheticItalics(float aDegrees) {
wr::SyntheticItalics synthetic_italics;
synthetic_italics.angle =

Просмотреть файл

@ -97,8 +97,6 @@ pub type WrFontInstanceKey = FontInstanceKey;
type WrYuvColorSpace = YuvColorSpace;
/// cbindgen:field-names=[mNamespace, mHandle]
type WrColorDepth = ColorDepth;
/// cbindgen:field-names=[mNamespace, mHandle]
type WrColorRange = ColorRange;
#[repr(C)]
@ -2558,7 +2556,6 @@ pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState,
image_key_2: WrImageKey,
color_depth: WrColorDepth,
color_space: WrYuvColorSpace,
color_range: WrColorRange,
image_rendering: ImageRendering) {
debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
@ -2579,7 +2576,6 @@ pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState,
YuvData::PlanarYCbCr(image_key_0, image_key_1, image_key_2),
color_depth,
color_space,
color_range,
image_rendering);
}
@ -2594,7 +2590,6 @@ pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
image_key_1: WrImageKey,
color_depth: WrColorDepth,
color_space: WrYuvColorSpace,
color_range: WrColorRange,
image_rendering: ImageRendering) {
debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
@ -2615,7 +2610,6 @@ pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState,
YuvData::NV12(image_key_0, image_key_1),
color_depth,
color_space,
color_range,
image_rendering);
}
@ -2629,7 +2623,6 @@ pub extern "C" fn wr_dp_push_yuv_interleaved_image(state: &mut WrState,
image_key_0: WrImageKey,
color_depth: WrColorDepth,
color_space: WrYuvColorSpace,
color_range: WrColorRange,
image_rendering: ImageRendering) {
debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() });
@ -2650,7 +2643,6 @@ pub extern "C" fn wr_dp_push_yuv_interleaved_image(state: &mut WrState,
YuvData::InterleavedYCbCr(image_key_0),
color_depth,
color_space,
color_range,
image_rendering);
}

Просмотреть файл

@ -165,7 +165,6 @@ impl Example for App {
YuvData::NV12(yuv_chanel1, yuv_chanel2),
ColorDepth::Color8,
YuvColorSpace::Rec601,
ColorRange::Limited,
ImageRendering::Auto,
);
@ -179,7 +178,6 @@ impl Example for App {
YuvData::PlanarYCbCr(yuv_chanel1, yuv_chanel2_1, yuv_chanel3),
ColorDepth::Color8,
YuvColorSpace::Rec601,
ColorRange::Limited,
ImageRendering::Auto,
);

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use api::{AlphaType, ClipMode, ExternalImageType, ImageRendering};
use api::{YuvColorSpace, YuvFormat, ColorDepth, ColorRange, PremultipliedColorF, RasterSpace};
use api::{YuvColorSpace, YuvFormat, ColorDepth, PremultipliedColorF, RasterSpace};
use api::units::*;
use crate::clip::{ClipDataStore, ClipNodeFlags, ClipNodeRange, ClipItem, ClipStore, ClipNodeInstance};
use crate::clip_scroll_tree::{ClipScrollTree, ROOT_SPATIAL_NODE_INDEX, SpatialNodeIndex, CoordinateSystemId};
@ -55,7 +55,7 @@ pub enum BrushBatchKind {
source_id: RenderTaskId,
backdrop_id: RenderTaskId,
},
YuvImage(ImageBufferKind, YuvFormat, ColorDepth, YuvColorSpace, ColorRange),
YuvImage(ImageBufferKind, YuvFormat, ColorDepth, YuvColorSpace),
RadialGradient,
LinearGradient,
}
@ -1897,7 +1897,6 @@ impl BatchBuilder {
yuv_image_data.format,
yuv_image_data.color_depth,
yuv_image_data.color_space,
yuv_image_data.color_range,
);
let batch_params = BrushBatchParameters::shared(

Просмотреть файл

@ -10,7 +10,7 @@ use api::{IframeDisplayItem, ImageKey, ImageRendering, ItemRange, ColorDepth};
use api::{LineOrientation, LineStyle, NinePatchBorderSource, PipelineId};
use api::{PropertyBinding, ReferenceFrame, ReferenceFrameKind, ScrollFrameDisplayItem, ScrollSensitivity};
use api::{Shadow, SpaceAndClipInfo, SpatialId, StackingContext, StickyFrameDisplayItem};
use api::{ClipMode, PrimitiveKeyKind, TransformStyle, YuvColorSpace, ColorRange, YuvData, TempFilterData};
use api::{ClipMode, PrimitiveKeyKind, TransformStyle, YuvColorSpace, YuvData, TempFilterData};
use api::units::*;
use crate::clip::{ClipChainId, ClipRegion, ClipItemKey, ClipStore};
use crate::clip_scroll_tree::{ROOT_SPATIAL_NODE_INDEX, ClipScrollTree, SpatialNodeIndex};
@ -1017,7 +1017,6 @@ impl<'a> DisplayListFlattener<'a> {
info.yuv_data,
info.color_depth,
info.color_space,
info.color_range,
info.image_rendering,
);
}
@ -3020,7 +3019,6 @@ impl<'a> DisplayListFlattener<'a> {
yuv_data: YuvData,
color_depth: ColorDepth,
color_space: YuvColorSpace,
color_range: ColorRange,
image_rendering: ImageRendering,
) {
let format = yuv_data.get_format();
@ -3039,7 +3037,6 @@ impl<'a> DisplayListFlattener<'a> {
yuv_key,
format,
color_space,
color_range,
image_rendering,
},
);

Просмотреть файл

@ -5,7 +5,7 @@
use api::{
AlphaType, ColorDepth, ColorF, ColorU,
ImageKey as ApiImageKey, ImageRendering,
PremultipliedColorF, Shadow, YuvColorSpace, ColorRange, YuvFormat,
PremultipliedColorF, Shadow, YuvColorSpace, YuvFormat,
};
use api::units::*;
use crate::display_list_flattener::{CreateShadow, IsVisible};
@ -370,7 +370,6 @@ pub struct YuvImage {
pub yuv_key: [ApiImageKey; 3],
pub format: YuvFormat,
pub color_space: YuvColorSpace,
pub color_range: ColorRange,
pub image_rendering: ImageRendering,
}
@ -403,7 +402,6 @@ pub struct YuvImageData {
pub yuv_key: [ApiImageKey; 3],
pub format: YuvFormat,
pub color_space: YuvColorSpace,
pub color_range: ColorRange,
pub image_rendering: ImageRendering,
}
@ -414,7 +412,6 @@ impl From<YuvImage> for YuvImageData {
yuv_key: image.yuv_key,
format: image.format,
color_space: image.color_space,
color_range: image.color_range,
image_rendering: image.image_rendering,
}
}
@ -531,7 +528,7 @@ fn test_struct_sizes() {
assert_eq!(mem::size_of::<Image>(), 52, "Image size changed");
assert_eq!(mem::size_of::<ImageTemplate>(), 104, "ImageTemplate size changed");
assert_eq!(mem::size_of::<ImageKey>(), 64, "ImageKey size changed");
assert_eq!(mem::size_of::<YuvImage>(), 32, "YuvImage size changed");
assert_eq!(mem::size_of::<YuvImage>(), 28, "YuvImage size changed");
assert_eq!(mem::size_of::<YuvImageTemplate>(), 48, "YuvImageTemplate size changed");
assert_eq!(mem::size_of::<YuvImageKey>(), 40, "YuvImageKey size changed");
}

Просмотреть файл

@ -1053,7 +1053,6 @@ pub struct YuvImageDisplayItem {
pub yuv_data: YuvData,
pub color_depth: ColorDepth,
pub color_space: YuvColorSpace,
pub color_range: ColorRange,
pub image_rendering: ImageRendering,
}
@ -1065,13 +1064,6 @@ pub enum YuvColorSpace {
Rec2020 = 2,
}
#[repr(u8)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize, PeekPoke)]
pub enum ColorRange {
Limited = 0,
Full = 1,
}
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize, PeekPoke)]
pub enum YuvData {
NV12(ImageKey, ImageKey), // (Y channel, CbCr interleaved channel)
@ -1403,7 +1395,6 @@ impl_default_for_enums! {
ImageRendering => Auto,
AlphaType => Alpha,
YuvColorSpace => Rec601,
ColorRange => Limited,
YuvData => NV12(ImageKey::default(), ImageKey::default()),
YuvFormat => NV12,
FilterPrimitiveInput => Original,

Просмотреть файл

@ -1023,7 +1023,6 @@ impl DisplayListBuilder {
yuv_data: di::YuvData,
color_depth: ColorDepth,
color_space: di::YuvColorSpace,
color_range: di::ColorRange,
image_rendering: di::ImageRendering,
) {
let item = di::DisplayItem::YuvImage(di::YuvImageDisplayItem {
@ -1032,7 +1031,6 @@ impl DisplayListBuilder {
yuv_data,
color_depth,
color_space,
color_range,
image_rendering,
});
self.push_item(&item);

Просмотреть файл

@ -1164,7 +1164,6 @@ impl YamlFrameReader {
// TODO(gw): Support other YUV color depth and spaces.
let color_depth = ColorDepth::Color8;
let color_space = YuvColorSpace::Rec709;
let color_range = ColorRange::Limited;
let yuv_data = match item["format"].as_str().expect("no format supplied") {
"planar" => {
@ -1211,7 +1210,6 @@ impl YamlFrameReader {
yuv_data,
color_depth,
color_space,
color_range,
ImageRendering::Auto,
);
}

Просмотреть файл

@ -1505,8 +1505,6 @@ class MediaPipelineReceiveVideo::PipelineListener
yuvData.mPicY = 0;
yuvData.mPicSize = IntSize(i420->width(), i420->height());
yuvData.mStereoMode = StereoMode::MONO;
// This isn't the best default.
yuvData.mYUVColorSpace = gfx::YUVColorSpace::BT601;
if (!yuvImage->CopyData(yuvData)) {
MOZ_ASSERT(false);