CVPixelBufferLockBaseAddress(pixelBuffer, 0);
const size_t lumaPlaneIndex = 0;
size_t lumaPlaneWidth = CVPixelBufferGetWidthOfPlane(pixelBuffer, lumaPlaneIndex);
size_t lumaPlaneHeight = CVPixelBufferGetHeightOfPlane(pixelBuffer, lumaPlaneIndex);
const size_t cbcrPlaneIndex = 1;
size_t cbcrPlaneWidth = CVPixelBufferGetWidthOfPlane(pixelBuffer, cbcrPlaneIndex);
size_t cbcrPlaneHeight = CVPixelBufferGetHeightOfPlane(pixelBuffer, cbcrPlaneIndex);
NSLog(@"lumaPlaneWidth: %zu", lumaPlaneWidth);
NSLog(@"lumaPlaneHeight: %zu", lumaPlaneHeight);
NSLog(@"cbcrPlaneWidth: %zu", cbcrPlaneWidth);
NSLog(@"cbcrPlaneHeight: %zu", cbcrPlaneHeight);
CVPixelBufferUnlockBaseAddress(pixelBuffer, 0);
Output on my iPhone 5 running iOS 7 for the front facing camera is:
lumaPlaneWidth: 1280
lumaPlaneHeight: 720
cbcrPlaneWidth: 640
cbcrPlaneHeight: 360
The luma (Y) plane is twice the size of the CbCr plane, why is this?