I'm trying to understand how does CMSampleBuffer
works. Eventually i'm looking for the most efficient way to change the CMSampleBuffer
pixels (which are at kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
format), into grayScale
pixels.
The final result would be (fast)grayscale live video stream.
I have tried the following :
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CVPixelBufferLockBaseAddress(imageBuffer, kCVPixelBufferLock_ReadOnly);
char *baseBuffer = (char *)CVPixelBufferGetBaseAddress(imageBuffer);
Which somehow suppose to indicate about the pixels. But from there i'm kind of lost. Any suggestions folks?