зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543359 - P3. Add kCVPixelFormatType_420YpCbCr8BiPlanarFullRange support to MacIOSurface. r=mattwoodrow
This will allow to differentiate full range vs limited range YUV. Differential Revision: https://phabricator.services.mozilla.com/D27211 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0171b0edb2
Коммит
c070ea1f0e
|
@ -472,9 +472,10 @@ already_AddRefed<SourceSurface> MacIOSurface::GetAsSurface() {
|
|||
|
||||
SurfaceFormat MacIOSurface::GetFormat() const {
|
||||
OSType pixelFormat = GetPixelFormat();
|
||||
if (pixelFormat == '420v') {
|
||||
if (pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange ||
|
||||
pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) {
|
||||
return SurfaceFormat::NV12;
|
||||
} else if (pixelFormat == '2vuy') {
|
||||
} else if (pixelFormat == kCVPixelFormatType_422YpCbCr8) {
|
||||
return SurfaceFormat::YUV422;
|
||||
} else {
|
||||
return HasAlpha() ? SurfaceFormat::R8G8B8A8 : SurfaceFormat::R8G8B8X8;
|
||||
|
@ -483,9 +484,10 @@ SurfaceFormat MacIOSurface::GetFormat() const {
|
|||
|
||||
SurfaceFormat MacIOSurface::GetReadFormat() const {
|
||||
OSType pixelFormat = GetPixelFormat();
|
||||
if (pixelFormat == '420v') {
|
||||
if (pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange ||
|
||||
pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) {
|
||||
return SurfaceFormat::NV12;
|
||||
} else if (pixelFormat == '2vuy') {
|
||||
} else if (pixelFormat == kCVPixelFormatType_422YpCbCr8) {
|
||||
return SurfaceFormat::R8G8B8X8;
|
||||
} else {
|
||||
return HasAlpha() ? SurfaceFormat::R8G8B8A8 : SurfaceFormat::R8G8B8X8;
|
||||
|
@ -512,7 +514,8 @@ CGLError MacIOSurface::CGLTexImageIOSurface2D(
|
|||
GLenum internalFormat;
|
||||
GLenum format;
|
||||
GLenum type;
|
||||
if (pixelFormat == '420v') {
|
||||
if (pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange ||
|
||||
pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) {
|
||||
MOZ_ASSERT(GetPlaneCount() == 2);
|
||||
MOZ_ASSERT(plane < 2);
|
||||
|
||||
|
@ -530,7 +533,7 @@ CGLError MacIOSurface::CGLTexImageIOSurface2D(
|
|||
if (aOutReadFormat) {
|
||||
*aOutReadFormat = mozilla::gfx::SurfaceFormat::NV12;
|
||||
}
|
||||
} else if (pixelFormat == '2vuy') {
|
||||
} else if (pixelFormat == kCVPixelFormatType_422YpCbCr8) {
|
||||
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
|
||||
|
|
|
@ -137,6 +137,9 @@ 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 *.
|
||||
|
|
|
@ -1008,7 +1008,7 @@ bool GLBlitHelper::BlitImage(layers::MacIOSurfaceImage* const srcImage,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (pixelFormat == '2vuy') {
|
||||
if (pixelFormat == kCVPixelFormatType_422YpCbCr8) {
|
||||
fragBody = kFragBody_CrYCb;
|
||||
// APPLE_rgb_422 adds RGB_RAW_422_APPLE for `internalFormat`, but only RGB
|
||||
// seems to work?
|
||||
|
|
Загрузка…
Ссылка в новой задаче