Same problem, except I only need to Download Container which doesn't work with Xcode 15.3 on MacOS Sonoma 14.2.1 using an iPhone 14 Pro.
Or to be precise - it works, but the Container contains only very little data :-/
Since the problem seems to be related to the updated debugging system I installed the latest Xcode 14.3.1 from xcodereleases.com.
That done I had to change the CFBundleVersion in the Info.plist + Version.plist to 22265, as mentioned here: https://stackoverflow.com/questions/76958016/is-there-a-way-to-run-xcode-14-on-macos-sonoma
Now I can run Xcode 14.2.1 and Download a full container :-)
It might work for Replacement also?
Cheers
Thomas Rued
Post
Replies
Boosts
Views
Activity
I'm also investigating Gain Map's, and in addition to the documentation you are referring to, I also found this PDF from Adobe:
https://helpx.adobe.com/content/dam/help/en/camera-raw/using/gain-map/jcr_content/root/content/flex/items/position/position-par/table/row-3u03dx0-column-4a63daf/download_section/download-1/Gain_Map_1_0d12.pdf
In here here you will find pseudocode for both encoding and decoding.
However, the problem is that Adobe's encoding calculates some values, that you are supposed to pass as metadata, and use in the decoding.
At this point I'm unsure if Apple supports Adobe decoding using this metadata or only their own Maps and decoding?
Also for both Apple and Adobe Gain Maps the real problem is that we have no way to write Gain Maps 100% using Apple API's.
I found this discussion: https://gist.github.com/kiding/fa4876ab4ddc797e3f18c71b3c2eeb3a
They suggest the usage of a non-public CIImageOption called: kCIImageRepresentationHDRGainMapImage.
This brings us half the way, however we still miss some XMP based metadata, that seems to have some effect when Apple decode an Image containing a GainMap.
It seems to be in this form:
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:HDRGainMap="http://ns.apple.com/HDRGainMap/1.0/">
<HDRGainMap:HDRGainMapVersion>65536</HDRGainMap:HDRGainMapVersion>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
So, another solution is to use CGImage:
What I found is this - when you decode a file that contains a Gain Map, you get the following info:
let gainmap = CGImageSourceCopyAuxiliaryDataInfoAtIndex(source, 0, kCGImageAuxiliaryDataTypeHDRGainMap)
let gainDict = NSDictionary(dictionary: gainmap)
let gainData = gainDict[kCGImageAuxiliaryDataInfoData] as? Data
let gainDescription = gainDict[kCGImageAuxiliaryDataInfoDataDescription]
let gainMeta = gainDict[kCGImageAuxiliaryDataInfoMetadata]
.. I believe it's somehow possible to create a CVPixelBuffer from Dict. And if so, You should be able to deduct how to create a fresh Gain Map dict.
That done the problem is that I have found no way to save this as more that 8 bpc - Apple strongly pushes 10 bit usage in iOS 17, which seems to be impossible when using the CGImage method described.
So still work to do, but hopefully this can help you get some kind of progress, and please share your findings, since I'm also researching this.
Cheers
Thomas
Same issue. First encounter was 8 Dec 2021, 4am CET.
Used most of the day yesterday to hunt it down, and found the problem was the missing libswift_Concurrency.dylib by looking in the device lock. So step 4 in @zack1001 solution above worked for me :-)