On 8 Mar 2014, at 4:12 pm, Trygve Inda <cocoa...@xericdesign.com> wrote:

> I get the same times doing it this way, but maybe my color spaces are
> different. The CGImage returned from my AVAsset is:
> 
> <CGColorSpace 0x100550490> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB;
> Composite NTSC)
> 
> I am not really sure what color space to pass into:
> 
> [NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL.....

> 
> Currently I am using NSDeviceRGBColorSpace.
> 
> Any thoughts?
> 
> T.

My guess is that this is a mismatch, because while both spaces are RGB, one is 
NTSC derived and the other probably a simple linear RGB.


Unfortunately NSBitmapImageRep only accepts a colour space *name*. It might be 
that the colorspace used by your images doesn't have a name - try using 
CGColorSpaceCopyName on the CGColorSpaceRef you get from CGImageGetColorSpace.

If it's NULL, you'll have to drop down to:

CGBitmapContextCreate(...) which accepts the actual CGColorSpaceRef. This will 
also accept the CGBitmapInfo obtained from your image to ensure that the format 
matches.

Once done compositing, use CGBitmapContextCreateImage to get the CGImage (which 
shouldn't do an additional copy of the buffer as long as you treat the image as 
read-only), then initialize an NSImage from it (again, should be only a wrap 
operation). At this point you'll have an image using the original NTSC 
colorspace. If that has to be drawn to the screen, likely it will need to do a 
similar conversion. Could be that what you gain on the roundabouts you'll lose 
on the swings. 

--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to