I am trying to capture a still image with 8 megapixels. I spent the time spent on the camera pipeline to go to the completion handler. On average, the iPhone 5S takes 0.33 seconds when the iPhone 5 takes less than 0.15 seconds. any body explains this. This is my profiling code.
__block NSDate *TimerAcross = [NSDate date];
[stillImageOutput captureStillImageAsynchronouslyFromConnection:connection
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error)
{
DLog(@"handler call timer = %f", [[NSDate date] timeIntervalSinceDate:TimerAcross]);
}`
When I try to use the same code in a square cam (apple demo code). I see that the time spent on the iPhone 5S is about 0.6 and less than that of the iPhone 5. What is the reason for this.
My settings are for capturing YUVSP images. `NSMutableDictionary * outputSettings = [NSMutableDictionary dictionaryWithObject: AVVideoCodecJPEG forKey: AVVideoCodecKey];
[outputSettings setValue: @ (kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) forKey: (id) kCVPixelBufferPixelFormatTypeKey];
NSMutableDictionary *videoOutputSettings = [NSDictionary dictionaryWithObject:@(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) forKey:(id)kCVPixelBufferPixelFormatTypeKey];
[stillImageOutput setOutputSettings:outputSettings];
[videoDataOutput setVideoSettings:videoOutputSettings];
videoDataOutput.alwaysDiscardsLateVideoFrames = YES;
if([captureSession canAddOutput:stillImageOutput] && [captureSession canAddOutput:videoDataOutput])
{
[captureSession addOutput:videoDataOutput];
[captureSession addOutput:stillImageOutput];
NSLog(@"added output to captureSession");
return YES;
}
else
{
NSLog(@"error in adding still image output");
return NO;
}
} `
source
share