Cannot efficiently create 'linear-space' floating-point grayscale CIImage on Mavericks
| Originator: | raphael | ||
| Number: | rdar://15369614 | Date Originated: | 01-Nov-2013 09:56 AM |
| Status: | Open | Resolved: | |
| Product: | OS X SDK | Product Version: | Mavericks 13A603 |
| Classification: | Enhancement | Reproducible: | Always |
Summary:
On Mavericks, it is not anymore possible to efficiently create a linear space floating-point grayscale CIImage.
Steps to Reproduce:
This was possible on Mountain Lion and previous OS versions with the following code:
CGColorSpaceRef bwspace = CGColorSpaceCreateDeviceGray();
CGDataProviderRef provider = CGDataProviderCreateWithCFData((CFDataRef)grayData);
CGImageRef image = CGImageCreate(w, h, 32, 32, bpr/4, bwspace, kCGImageAlphaNone | kCGBitmapFloatComponents | kCGBitmapByteOrder32Host, provider, NULL, NO, kCGRenderingIntentDefault);
CGColorSpaceRelease(bwspace);
// that's the combination of gray device + linear RGB in override that gives correct result.
outputImage = [CIImage imageWithCGImage:image options:@{kCIImageColorSpace: linearRGBColorspace}];
Expected Results:
It would previously allow unclamped values with linear scale (gamma = 1.0).
Actual Results:
On Mavericks, this creates a 'regular' grayscale image with values clamped to [0,1], and a gamma of 2.2.
Regression:
All Macs running Mavericks are affected.
Notes:
This is a major problem, because linear grayscale images are very useful in image processing. It is still possible to create such an image but it is now required to use RGBA floating-point input data. To put that in perspective, a 20MP grayscale floating-point linear image would take 80MB of RAM. Now, with RGBAf, it requires 320MB to represent the same image in memory, which is both inefficient and cumbersome (can even lead to crash if no more RAM is available).
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!