Bug 1421187 - P4. Make mac decoder output YUV420 format. r=mattwoodrow

There's little advantage over using NV12 and using YUV420 allows for easier and faster frame copy. We assume of course that Apple's VideoToolbox have more optimized code than we do.

MozReview-Commit-ID: IjvepxW3OZI

--HG--
extra : rebase_source : 089f5a63c4871366aed8f0c0ef3ef6bd3c2d0a0f
This commit is contained in:
Jean-Yves Avenard 2017-11-28 16:41:40 +01:00
Родитель 4fd0cbda6e
Коммит 46c877fa75
1 изменённых файлов: 7 добавлений и 7 удалений

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

@ -361,7 +361,7 @@ AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage,
size_t width = CVPixelBufferGetWidth(aImage);
size_t height = CVPixelBufferGetHeight(aImage);
DebugOnly<size_t> planes = CVPixelBufferGetPlaneCount(aImage);
MOZ_ASSERT(planes == 2, "Likely not NV12 format and it must be.");
MOZ_ASSERT(planes == 3, "Likely not YUV420 format and it must be.");
VideoData::YCbCrBuffer buffer;
@ -391,15 +391,15 @@ AppleVTDecoder::OutputFrame(CVPixelBufferRef aImage,
buffer.mPlanes[1].mWidth = (width+1) / 2;
buffer.mPlanes[1].mHeight = (height+1) / 2;
buffer.mPlanes[1].mOffset = 0;
buffer.mPlanes[1].mSkip = 1;
buffer.mPlanes[1].mSkip = 0;
// Cr plane.
buffer.mPlanes[2].mData =
static_cast<uint8_t*>(CVPixelBufferGetBaseAddressOfPlane(aImage, 1));
buffer.mPlanes[2].mStride = CVPixelBufferGetBytesPerRowOfPlane(aImage, 1);
static_cast<uint8_t*>(CVPixelBufferGetBaseAddressOfPlane(aImage, 2));
buffer.mPlanes[2].mStride = CVPixelBufferGetBytesPerRowOfPlane(aImage, 2);
buffer.mPlanes[2].mWidth = (width+1) / 2;
buffer.mPlanes[2].mHeight = (height+1) / 2;
buffer.mPlanes[2].mOffset = 1;
buffer.mPlanes[2].mSkip = 1;
buffer.mPlanes[2].mOffset = 0;
buffer.mPlanes[2].mSkip = 0;
gfx::IntRect visible = gfx::IntRect(0,
0,
@ -602,7 +602,7 @@ AppleVTDecoder::CreateOutputConfiguration()
if (mUseSoftwareImages) {
// Output format type:
SInt32 PixelFormatTypeValue =
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
kCVPixelFormatType_420YpCbCr8Planar;
AutoCFRelease<CFNumberRef> PixelFormatTypeNumber =
CFNumberCreate(kCFAllocatorDefault,
kCFNumberSInt32Type,