I encountered a problem when using СП
for (int16_t j = 0; j <= 1/kAlphaStep; j++) {
UIImage *blendingImage = [UIImage imageByBlendingImage:firstImage andImage:secondImage alpha:kAlphaStep*j];
buffer = [self pixelBufferFromImage:blendingImage andSize:size];
...}
And
- (CVPixelBufferRef)pixelBufferFromImage:(UIImage *)img andSize:(CGSize)size {
CGImageRef image = img.CGImage;
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey,
[NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey,
nil];
CVPixelBufferRef pxbuffer = NULL;
CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, size.width,
size.height, kCVPixelFormatType_32ARGB, (__bridge CFDictionaryRef) options,
&pxbuffer);
NSParameterAssert(status == kCVReturnSuccess && pxbuffer != NULL);
...
return pxbuffer;
}
And while I'm in the loop, all CGImageRef
in memory.
If I use
if (image) {
CGImageRelease(image);
}
app crashed. Please help me!!