Post

Replies

Boosts

Views

Activity

Reply to Adding HDR Gain Map to HEIF/JPEG manually
I think I found the reason why the gain map isn't showing any effect: There seem to be two private {MakerApple} EXIF tags controlling the HDR effect. The one @anteo83 mentioned (0x21) seems to control the global boost to brightness. I guess via some kind of gamma curve tone mapping. But there is also the 0x30 which controls how much the embedded gain map adds to the effect. It seems to range between 0.0 and 8.0, with 0.0 having the biggest effect. When 0x30 is present, 0x21 doesn't need to be present to show the effects of the gain map. They also seem to work in tandem, with 0x21 adding to the global value and 0x30 controlling local values via gain map. There is some great fun to be had with this. Check out the attached image on your XDR or OLED device in Photos. 😁 Edit: I was trying to attach an example image here, but Forums seem to convert the image, losing the gain map in the process. You can find it here.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’22
Reply to Validation failed error code when attempting to activate a Core Media I/O extension
I encountered the same. When I re-watched the session, I heard Brad say the following: And I need to ensure here that my extension's app group is prefixed by the MachServiceName in order for it to pass validation. I changed the CMIOExtensionMachServiceName in the extension's Info.plist to the same value as my app's and extension's app group name and suddenly it passed validation. I'm not sure if this is the intended configuration. Maybe Apple's Extensions team can clarify what the "prefixed" means here and what the values should look like.
Topic: App & System Services SubTopic: Drivers Tags:
Jun ’22
Reply to CISourceOverComposition unexpected behavior
I guess this is happening because CIPhotoEffectTonal also has an effect on the transparent parts of the image. If you want to limit the effect to the visible part, you can simply crop the image after the effect is applied and before you blend it over the background: video1FilteredImage = [video1FilteredImage imageByCroppingToRect:video1FilteredImage.extent]; By the way: instead of using CIConstantColorGenerator you can simply get a colored image like this: CIImage *colorBackgroundImage = [CIImage imageWithColor:inputColor];
Topic: Media Technologies SubTopic: General Tags:
May ’22
Reply to QR Code Generator (CIFilter) colours for light/dark mode ?
You can use the QR code as a mask and blend it with a solid color to effectively colorize it. So you can, for example, create a black and a white version and use the register(...) method of UIImage to "bundle" them both into one dynamic image: let qrCode = filter.outputImage!.transformed(by: transform) // Use the QR code as a mask for blending with a color. // Note that we need to invert the code for that, so the actual code becomes white // and the background becomes black, because white = let color through, black = transparent. let maskFilter = CIFilter.blendWithMask() maskFilter.maskImage = qrCode.applyingFilter("CIColorInvert") // create a version of the code with black foreground... maskFilter.inputImage = CIImage(color: .black) let blackCIImage = maskFilter.outputImage! // ... and one with white foreground maskFilter.inputImage = CIImage(color: .white) let whiteCIImage = maskFilter.outputImage! // render both images let blackImage = context.createCGImage(blackCIImage, from: blackCIImage.extent).map(UIImage.init)! let whiteImage = context.createCGImage(whiteCIImage, from: whiteCIImage.extent).map(UIImage.init)! // use black version for light mode qrImage = blackImage // assign the white version to be used in dark mode qrImage.imageAsset?.register(whiteImage, with: UITraitCollection(userInterfaceStyle: .dark)) return qrImage
Topic: Media Technologies SubTopic: General Tags:
Mar ’22
Reply to OpenEXR conversion
I recommend using Core Image to read, write, and modify EXR images. Core Image can already natively open PNG and EXR files and write PNG data and files. However, there is no convenient way for writing EXR data of files. That's why we wrote extensions for doing exactly that. You can find them over at Github.
Topic: Media Technologies SubTopic: General Tags:
Feb ’22
Reply to Passing MTLTexture to Metal Core Image Kernel
You can simply initialize a CIImage with the texture and pass that to the kernel: let ciImage = CIImage(mtlTexture: texture) The documentation also mentions what you need to do to let Core Image render into a Metal texture. If you want to incorporate a Metal processing step into a Core Image pipeline instead, I recommend you check out CIImageProcessorKernel.
Topic: Graphics & Games SubTopic: Metal Tags:
Jan ’22
Reply to Adding HDR Gain Map to HEIF/JPEG manually
I think I found the reason why the gain map isn't showing any effect: There seem to be two private {MakerApple} EXIF tags controlling the HDR effect. The one @anteo83 mentioned (0x21) seems to control the global boost to brightness. I guess via some kind of gamma curve tone mapping. But there is also the 0x30 which controls how much the embedded gain map adds to the effect. It seems to range between 0.0 and 8.0, with 0.0 having the biggest effect. When 0x30 is present, 0x21 doesn't need to be present to show the effects of the gain map. They also seem to work in tandem, with 0x21 adding to the global value and 0x30 controlling local values via gain map. There is some great fun to be had with this. Check out the attached image on your XDR or OLED device in Photos. 😁 Edit: I was trying to attach an example image here, but Forums seem to convert the image, losing the gain map in the process. You can find it here.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’22
Reply to Is the CIFilterCam source code available anywhere?
Yes, that would be very helpful! I also filed that request under FB10224187.
Replies
Boosts
Views
Activity
Jun ’22
Reply to Validation failed error code when attempting to activate a Core Media I/O extension
I encountered the same. When I re-watched the session, I heard Brad say the following: And I need to ensure here that my extension's app group is prefixed by the MachServiceName in order for it to pass validation. I changed the CMIOExtensionMachServiceName in the extension's Info.plist to the same value as my app's and extension's app group name and suddenly it passed validation. I'm not sure if this is the intended configuration. Maybe Apple's Extensions team can clarify what the "prefixed" means here and what the values should look like.
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Allow 16-bit RGBA image formats as input/output of MLModels
Also filed under FB10151072.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Allow 16-bit RGBA image formats as input/output of MLModels
Also filed as FB10151072.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to CISourceOverComposition unexpected behavior
I guess this is happening because CIPhotoEffectTonal also has an effect on the transparent parts of the image. If you want to limit the effect to the visible part, you can simply crop the image after the effect is applied and before you blend it over the background: video1FilteredImage = [video1FilteredImage imageByCroppingToRect:video1FilteredImage.extent]; By the way: instead of using CIConstantColorGenerator you can simply get a colored image like this: CIImage *colorBackgroundImage = [CIImage imageWithColor:inputColor];
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to CIKernel ROI Callback Leak
Also filed as FB9989184.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to CIKernel call - performance hit and memory leak
You are capturing self in the roiCallback for no apparent reason. Can you please try to remove the [self] and check again?
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’22
Reply to Replacement for deprecated CIRAWFilterOption activeKeys
I think the whole RAW development is now handled by the new CIRAWFilter. This doesn't have an activeKeys property anymore. Instead, you can check for each property individually if it's supported or not. For instance with isContrastSupported or isMoireReductionSupported.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Support tiling in ML-based CIImageProcessorKernel
I also filed a corresponding Feedback (FB9949181). Thanks for looking into it!
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to QR Code Generator (CIFilter) colours for light/dark mode ?
You can use the QR code as a mask and blend it with a solid color to effectively colorize it. So you can, for example, create a black and a white version and use the register(...) method of UIImage to "bundle" them both into one dynamic image: let qrCode = filter.outputImage!.transformed(by: transform) // Use the QR code as a mask for blending with a color. // Note that we need to invert the code for that, so the actual code becomes white // and the background becomes black, because white = let color through, black = transparent. let maskFilter = CIFilter.blendWithMask() maskFilter.maskImage = qrCode.applyingFilter("CIColorInvert") // create a version of the code with black foreground... maskFilter.inputImage = CIImage(color: .black) let blackCIImage = maskFilter.outputImage! // ... and one with white foreground maskFilter.inputImage = CIImage(color: .white) let whiteCIImage = maskFilter.outputImage! // render both images let blackImage = context.createCGImage(blackCIImage, from: blackCIImage.extent).map(UIImage.init)! let whiteImage = context.createCGImage(whiteCIImage, from: whiteCIImage.extent).map(UIImage.init)! // use black version for light mode qrImage = blackImage // assign the white version to be used in dark mode qrImage.imageAsset?.register(whiteImage, with: UITraitCollection(userInterfaceStyle: .dark)) return qrImage
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to OpenEXR conversion
I recommend using Core Image to read, write, and modify EXR images. Core Image can already natively open PNG and EXR files and write PNG data and files. However, there is no convenient way for writing EXR data of files. That's why we wrote extensions for doing exactly that. You can find them over at Github.
Topic: Media Technologies SubTopic: General Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to Rendering Core Image to MTLTexture causes huge memory use
Hmm, your code seems ok so far. I guess the issue is caused by something else... Are you sure the texture you create here is released properly? Also, can you please try passing nil as commandBuffer in [context render:...]?
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Passing MTLTexture to Metal Core Image Kernel
You can simply initialize a CIImage with the texture and pass that to the kernel: let ciImage = CIImage(mtlTexture: texture) The documentation also mentions what you need to do to let Core Image render into a Metal texture. If you want to incorporate a Metal processing step into a Core Image pipeline instead, I recommend you check out CIImageProcessorKernel.
Topic: Graphics & Games SubTopic: Metal Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Create AVSemanticSegmentationMatte from image data seems to leak memory
Does it still exist after you released the CIContext you used for rendering? The context usually caches some intermediate images and objects to speed up consecutive render calls.
Replies
Boosts
Views
Activity
Dec ’21