我使用vImageConvert_RGB888toPlanar8
and vImageConvert_Planar8toRGB888
from Accelerate.framework将RGB24转换为BGR24,但是当需要转换的数据非常大时,比如3M或4M,这需要花费的时间大约是10ms。所以有人知道一些足够快的想法吗?我的代码是这样的:
- (void)transformRGBToBGR:(const UInt8 *)pict{
rgb.data = (void *)pict;
vImage_Error error = vImageConvert_RGB888toPlanar8(&rgb,&red,&green,&blue,kvImageNoFlags);
if (error != kvImageNoError) {
NSLog(@"vImageConvert_RGB888toARGB8888 error");
}
error = vImageConvert_Planar8toRGB888(&blue,&green,&red,&bgr,kvImageNoFlags);
if (error != kvImageNoError) {
NSLog(@"vImagePermuteChannels_ARGB8888 error");
}
free((void *)pict);
}