-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Unless I am misunderstanding something, it seems like you are introducing a lot of unnecessary complexity by using Metal to convert between color spaces. It looks like Core Image can do the job for you?
-[CIImage initWithCVPixelBuffer:]will build and use the color space from the color space attachments in the image buffer.kCIContextWorkingColorSpacecan be used to specify the working color space of theCIContext. You would use the same color space as theCIImage(via-[CIImage colorSpace]).- From here, you can convert the
CIImageto any other image format, specifying the destination color space (in your case, sRGB) in the respective conversion functions.- Use
-[CIImage imageByColorMatchingWorkingSpaceToColorSpace:]to get anotherCIImage(e.g. to put into aUIImagefor display in aUIImageView). - Use
-[CIContext createCGImage:fromRect:format:colorSpace:]to get aCGImage. - Use
-[CIContext render:toCVPixelBuffer:bounds:colorSpace:]to render into aCVPixelBuffer. - Use
-[CIContext render:toIOSurface:bounds:colorSpace:]to render into anIOSurface. - Use
-[CIContext render:toMTLTexture:commandBuffer:bounds:colorSpace:]to render into aMTLTexture.
- Use
(Caveat: I have not personally tested any of these functions except the first one.)
Metadata
Metadata
Assignees
Labels
No labels