Note that there are some explanatory texts on larger screens.

plurals
  1. POThe iPhone 3GS and kCVPixelFormatType_420YpCbCr8BiPlanarFullRange format?
    primarykey
    data
    text
    <p>I'm developing an iOS application with latest SDK and testing it on an iPhone 3GS.</p> <p>I'm doing this on init method:</p> <pre><code>CFDictionaryRef formatDictionary = CVPixelFormatDescriptionCreateWithPixelFormatType(kCFAllocatorDefault, kCVPixelFormatType_420YpCbCr8BiPlanarFullRange); CFNumberRef val = (CFNumberRef) CFDictionaryGetValue(formatDictionary, kCVPixelFormatBitsPerBlock); if (val != nil) { CFNumberGetValue(val,kCFNumberSInt8Type, &amp;_bytesPerPixel); _bytesPerPixel /= 8; } else _bytesPerPixel = 4; </code></pre> <p>But val is always nil.</p> <p>And here:</p> <pre><code>- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection { CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); //Lock the image buffer// CVPixelBufferLockBaseAddress(imageBuffer,0); //Get information about the image// uint8_t *baseAddress = (uint8_t *)CVPixelBufferGetBaseAddress(imageBuffer); size_t width = CVPixelBufferGetWidth(imageBuffer); size_t height = CVPixelBufferGetHeight(imageBuffer); //size_t stride = CVPixelBufferGetBytesPerRow(imageBuffer); //put buffer in open cv, no memory copied cv::Mat image = cv::Mat(height, width, CV_8UC4, baseAddress); // copy the image //cv::Mat copied_image = image.clone(); [_previewBufferLock lock]; memcpy(baseAddress, _lastFrame, _previewSurfaceHeight * _previewSurfaceWidth * _bytesPerPixel); [_previewBufferLock unlock]; //We unlock the image buffer// CVPixelBufferUnlockBaseAddress(imageBuffer,0); } </code></pre> <p>I have add a breakpoint on memcpy line and I these are my vars values:</p> <p><img src="https://i.stack.imgur.com/H5arO.png" alt="enter image description here"></p> <p>But I'm getting an EXEC_BAD_ACCESS here: <code>memcpy(baseAddress, _lastFrame, _previewSurfaceHeight * _previewSurfaceWidth * _bytesPerPixel);</code></p> <p><strong>Does the iPhone 3GS support kCVPixelFormatType_420YpCbCr8BiPlanarFullRange?</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload