【发布时间】:2012-04-16 04:33:12
【问题描述】:
我收到 YUV 帧 (kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange),当从 CVPixelBufferRef 创建 CIImage 时,我得到:
initWithCVPixelBuffer 失败,因为 CVPixelBufferRef 不是非 IOSurface 支持的。
CVPixelBufferRef pixelBuffer;
size_t planeWidth[] = { width, width / 2 };
size_t planeHeight[] = { height, height / 2};
size_t planeBytesPerRow[] = { width, width / 2 };
CVReturn ret = CVPixelBufferCreateWithBytes(
kCFAllocatorDefault, width, height, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,
data, bytesPerRow, 0, 0, 0, &pixelBuffer
);
if (ret != kCVReturnSuccess)
{
NSLog(@"FAILED");
CVPixelBufferRelease(pixelBuffer);
return;
}
CVPixelBufferLockBaseAddress(pixelBuffer, 0);
// fails
CIImage * image = [[CIImage alloc] initWithCVPixelBuffer:pixelBuffer];
CVPixelBufferUnlockBaseAddress(pixelBuffer, 0);
CVPixelBufferRelease(pixelBuffer);
[image release];
【问题讨论】:
-
你能解决这个问题吗?
标签: ios core-image