本文整理汇总了C++中SurfaceDescriptor::get_YCbCrImage方法的典型用法代码示例。如果您正苦于以下问题:C++ SurfaceDescriptor::get_YCbCrImage方法的具体用法?C++ SurfaceDescriptor::get_YCbCrImage怎么用?C++ SurfaceDescriptor::get_YCbCrImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SurfaceDescriptor
的用法示例。
在下文中一共展示了SurfaceDescriptor::get_YCbCrImage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shmemImage
void
TextureHostYCbCrD3D11::UpdateImpl(const SurfaceDescriptor& aImage, nsIntRegion *aRegion)
{
MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TYCbCrImage);
ShmemYCbCrImage shmemImage(aImage.get_YCbCrImage().data(),
aImage.get_YCbCrImage().offset());
gfxIntSize gfxCbCrSize = shmemImage.GetCbCrSize();
gfxIntSize size = shmemImage.GetYSize();
D3D11_SUBRESOURCE_DATA initData;
initData.pSysMem = shmemImage.GetYData();
initData.SysMemPitch = shmemImage.GetYStride();
CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_R8_UNORM, size.width, size.height,
1, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_IMMUTABLE);
mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[0]));
initData.pSysMem = shmemImage.GetCbData();
initData.SysMemPitch = shmemImage.GetCbCrStride();
desc.Width = shmemImage.GetCbCrSize().width;
desc.Height = shmemImage.GetCbCrSize().height;
mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[1]));
initData.pSysMem = shmemImage.GetCrData();
mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[2]));
mSize = IntSize(size.width, size.height);
}
示例2: yuvDeserializer
void
DeprecatedTextureHostYCbCrD3D11::UpdateImpl(const SurfaceDescriptor& aImage,
nsIntRegion* aRegion,
nsIntPoint* aOffset)
{
MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TYCbCrImage);
YCbCrImageDataDeserializer yuvDeserializer(aImage.get_YCbCrImage().data().get<uint8_t>());
gfx::IntSize gfxCbCrSize = yuvDeserializer.GetCbCrSize();
gfx::IntSize size = yuvDeserializer.GetYSize();
D3D11_SUBRESOURCE_DATA initData;
initData.pSysMem = yuvDeserializer.GetYData();
initData.SysMemPitch = yuvDeserializer.GetYStride();
CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_A8_UNORM, size.width, size.height,
1, 1, D3D11_BIND_SHADER_RESOURCE,
D3D11_USAGE_IMMUTABLE);
mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[0]));
initData.pSysMem = yuvDeserializer.GetCbData();
initData.SysMemPitch = yuvDeserializer.GetCbCrStride();
desc.Width = yuvDeserializer.GetCbCrSize().width;
desc.Height = yuvDeserializer.GetCbCrSize().height;
mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[1]));
initData.pSysMem = yuvDeserializer.GetCrData();
mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[2]));
mSize = IntSize(size.width, size.height);
}
示例3: ConvertImageToRGB
void ConvertImageToRGB(const SurfaceDescriptor& aImage)
{
YCbCrImageDataDeserializer deserializer(aImage.get_YCbCrImage().data().get<uint8_t>());
PlanarYCbCrImage::Data data;
DeserializerToPlanarYCbCrImageData(deserializer, data);
gfxASurface::gfxImageFormat format = gfxASurface::ImageFormatRGB24;
gfxIntSize size;
gfxUtils::GetYCbCrToRGBDestFormatAndSize(data, format, size);
if (size.width > PlanarYCbCrImage::MAX_DIMENSION ||
size.height > PlanarYCbCrImage::MAX_DIMENSION) {
NS_ERROR("Illegal image dest width or height");
return;
}
mThebesSurface = mThebesImage =
new gfxImageSurface(size, format);
gfxUtils::ConvertYCbCrToRGB(data, format, size,
mThebesImage->Data(),
mThebesImage->Stride());
mSize = IntSize(size.width, size.height);
mFormat =
(format == gfxASurface::ImageFormatARGB32) ? FORMAT_B8G8R8A8 :
FORMAT_B8G8R8X8;
}
示例4: deserializer
void
YCbCrDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage,
nsIntRegion* aRegion,
nsIntPoint* aOffset)
{
if (!mGL) {
return;
}
NS_ASSERTION(aImage.type() == SurfaceDescriptor::TYCbCrImage, "SurfaceDescriptor mismatch");
YCbCrImageDataDeserializer deserializer(aImage.get_YCbCrImage().data().get<uint8_t>());
gfxIntSize gfxSize = deserializer.GetYSize();
gfxIntSize gfxCbCrSize = deserializer.GetCbCrSize();
if (!mYTexture->mTexImage || mYTexture->mTexImage->GetSize() != gfxSize) {
mYTexture->mTexImage = CreateBasicTextureImage(mGL,
gfxSize,
gfxASurface::CONTENT_ALPHA,
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
FlagsToGLFlags(mFlags));
}
if (!mCbTexture->mTexImage || mCbTexture->mTexImage->GetSize() != gfxCbCrSize) {
mCbTexture->mTexImage = CreateBasicTextureImage(mGL,
gfxCbCrSize,
gfxASurface::CONTENT_ALPHA,
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
FlagsToGLFlags(mFlags));
}
if (!mCrTexture->mTexImage || mCrTexture->mTexImage->GetSize() != gfxCbCrSize) {
mCrTexture->mTexImage = CreateBasicTextureImage(mGL,
gfxCbCrSize,
gfxASurface::CONTENT_ALPHA,
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
FlagsToGLFlags(mFlags));
}
RefPtr<gfxImageSurface> tempY = new gfxImageSurface(deserializer.GetYData(),
gfxSize, deserializer.GetYStride(),
gfxASurface::ImageFormatA8);
RefPtr<gfxImageSurface> tempCb = new gfxImageSurface(deserializer.GetCbData(),
gfxCbCrSize, deserializer.GetCbCrStride(),
gfxASurface::ImageFormatA8);
RefPtr<gfxImageSurface> tempCr = new gfxImageSurface(deserializer.GetCrData(),
gfxCbCrSize, deserializer.GetCbCrStride(),
gfxASurface::ImageFormatA8);
nsIntRegion yRegion(nsIntRect(0, 0, gfxSize.width, gfxSize.height));
nsIntRegion cbCrRegion(nsIntRect(0, 0, gfxCbCrSize.width, gfxCbCrSize.height));
mYTexture->mTexImage->DirectUpdate(tempY, yRegion);
mCbTexture->mTexImage->DirectUpdate(tempCb, cbCrRegion);
mCrTexture->mTexImage->DirectUpdate(tempCr, cbCrRegion);
}
示例5: IsSurfaceDescriptorOwned
bool IsSurfaceDescriptorOwned(const SurfaceDescriptor& aDescriptor)
{
switch (aDescriptor.type()) {
case SurfaceDescriptor::TYCbCrImage: {
const YCbCrImage& ycbcr = aDescriptor.get_YCbCrImage();
return ycbcr.owner() != 0;
}
case SurfaceDescriptor::TRGBImage: {
const RGBImage& rgb = aDescriptor.get_RGBImage();
return rgb.owner() != 0;
}
default:
return false;
}
return false;
}
示例6: yuvDeserializer
void
DeprecatedTextureHostYCbCrD3D9::UpdateImpl(const SurfaceDescriptor& aImage,
nsIntRegion *aRegion,
nsIntPoint *aOffset)
{
MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TYCbCrImage);
if (!mCompositor->device()) {
return;
}
YCbCrImageDataDeserializer yuvDeserializer(aImage.get_YCbCrImage().data().get<uint8_t>());
mSize = yuvDeserializer.GetYSize();
IntSize cbCrSize = yuvDeserializer.GetCbCrSize();
mStereoMode = yuvDeserializer.GetStereoMode();
DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
RefPtr<DataTextureSource> srcY;
RefPtr<DataTextureSource> srcCb;
RefPtr<DataTextureSource> srcCr;
if (!mFirstSource) {
srcY = new DataTextureSourceD3D9(SurfaceFormat::A8, mCompositor,
TEXTURE_DISALLOW_BIGIMAGE, mStereoMode);
srcCb = new DataTextureSourceD3D9(SurfaceFormat::A8, mCompositor,
TEXTURE_DISALLOW_BIGIMAGE, mStereoMode);
srcCr = new DataTextureSourceD3D9(SurfaceFormat::A8, mCompositor,
TEXTURE_DISALLOW_BIGIMAGE, mStereoMode);
mFirstSource = srcY;
srcY->SetNextSibling(srcCb);
srcCb->SetNextSibling(srcCr);
} else {
MOZ_ASSERT(mFirstSource->GetNextSibling());
MOZ_ASSERT(mFirstSource->GetNextSibling()->GetNextSibling());
srcY = mFirstSource;
srcCb = mFirstSource->GetNextSibling()->AsDataTextureSource();
srcCr = mFirstSource->GetNextSibling()->GetNextSibling()->AsDataTextureSource();
}
RefPtr<DataSourceSurface> wrapperY =
Factory::CreateWrappingDataSourceSurface(yuvDeserializer.GetYData(),
yuvDeserializer.GetYStride(),
yuvDeserializer.GetYSize(),
SurfaceFormat::A8);
RefPtr<DataSourceSurface> wrapperCb =
Factory::CreateWrappingDataSourceSurface(yuvDeserializer.GetCbData(),
yuvDeserializer.GetCbCrStride(),
yuvDeserializer.GetCbCrSize(),
SurfaceFormat::A8);
RefPtr<DataSourceSurface> wrapperCr =
Factory::CreateWrappingDataSourceSurface(yuvDeserializer.GetCrData(),
yuvDeserializer.GetCbCrStride(),
yuvDeserializer.GetCbCrSize(),
SurfaceFormat::A8);
// We don't support partial updates for YCbCr textures
NS_ASSERTION(!aRegion, "Unsupported partial updates for YCbCr textures");
if (!srcY->Update(wrapperY) ||
!srcCb->Update(wrapperCb) ||
!srcCr->Update(wrapperCr)) {
NS_WARNING("failed to update the DataTextureSource");
mSize.width = 0;
mSize.height = 0;
mFirstSource = nullptr;
return;
}
}