This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch geckoview-99.0.1-11.0-1 in repository tor-browser.
commit 7a5e4ed65b912df36de52d5825596be8c031a1be Author: Brad Werth bwerth@mozilla.com AuthorDate: Mon Mar 14 22:57:13 2022 +0000
Bug 1745492 Part 7: Set the color primaries and transfer functions for macOS HD and HDR video. r=media-playback-reviewers,bryce a=dmeehan
This also reorders the colorspace if-elses to explicitly check for bt601, bt709, and bt2020 in that order. This ensures that anything with the Identity colorspace will be left with no attachments.
Differential Revision: https://phabricator.services.mozilla.com/D140576 --- dom/media/platforms/apple/AppleVTDecoder.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/dom/media/platforms/apple/AppleVTDecoder.cpp b/dom/media/platforms/apple/AppleVTDecoder.cpp index d73928946a0ea..ce855db3a5c39 100644 --- a/dom/media/platforms/apple/AppleVTDecoder.cpp +++ b/dom/media/platforms/apple/AppleVTDecoder.cpp @@ -426,6 +426,12 @@ void AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage, // Unlock the returned image data. CVPixelBufferUnlockBaseAddress(aImage, kCVPixelBufferLock_ReadOnly); } else { +#if !defined(MAC_OS_VERSION_10_13) || \ + MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_10_13 + CFStringRef kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ = + CFSTR("SMPTE_ST_2084_PQ"); +#endif + #ifndef MOZ_WIDGET_UIKIT // Set pixel buffer properties on aImage before we extract its surface. // This ensures that we can use defined enums to set values instead @@ -434,13 +440,25 @@ void AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage, CVBufferSetAttachment(aImage, kCVImageBufferYCbCrMatrixKey, kCVImageBufferYCbCrMatrix_ITU_R_601_4, kCVAttachmentMode_ShouldPropagate); + } else if (mColorSpace == gfx::YUVColorSpace::BT709) { + CVBufferSetAttachment(aImage, kCVImageBufferYCbCrMatrixKey, + kCVImageBufferYCbCrMatrix_ITU_R_709_2, + kCVAttachmentMode_ShouldPropagate); + CVBufferSetAttachment(aImage, kCVImageBufferColorPrimariesKey, + kCVImageBufferColorPrimaries_ITU_R_709_2, + kCVAttachmentMode_ShouldPropagate); + CVBufferSetAttachment(aImage, kCVImageBufferTransferFunctionKey, + kCVImageBufferTransferFunction_ITU_R_709_2, + kCVAttachmentMode_ShouldPropagate); } else if (mColorSpace == gfx::YUVColorSpace::BT2020) { CVBufferSetAttachment(aImage, kCVImageBufferYCbCrMatrixKey, kCVImageBufferYCbCrMatrix_ITU_R_2020, kCVAttachmentMode_ShouldPropagate); - } else { - CVBufferSetAttachment(aImage, kCVImageBufferYCbCrMatrixKey, - kCVImageBufferYCbCrMatrix_ITU_R_709_2, + CVBufferSetAttachment(aImage, kCVImageBufferColorPrimariesKey, + kCVImageBufferColorPrimaries_ITU_R_2020, + kCVAttachmentMode_ShouldPropagate); + CVBufferSetAttachment(aImage, kCVImageBufferTransferFunctionKey, + kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ, kCVAttachmentMode_ShouldPropagate); }