Incorrect color rendering of some textures / patterns in RAW photos

The preview image for RAW captures renders colors incorrectly, for some textures or patterns. A customer of our app reported this problem when shooting photos of dresses for their business. We have been able to replicate it in dresses, too, when they contain high-frequency silvery areas. The rendered preview shows a clear green color cast that is far from accurate. See example here: https://www.dropbox.com/s/ma0s5mbzdxhpjdl/Preview%20in%20Files.pdf?dl=0. Original files attached to FB9674554.

We have observed this behaviour in iPhone 12 Pro and iPhone 13 Pro, but not in iPhone 11 Pro. It was first seen in iOS 14, but the problem still remains in iOS 15. This is a summary of the tests we performed to try to isolate the problem:

  • It only happens in RAW mode, not in Auto, Manual, or ProRAW.
  • Manually changing the exposure in RAW mode does not fix it.
  • Setting a lower quality in the capture APIs does not fix it.
  • If we capture the RAW image without requesting a preview or thumbnail to be embedded inside the DNG file, the problem still occurs when the image is previewed in Photos app.
  • If we develop the DNG using third party RAW-editing apps, the problem does not occur.
  • Previewing the DNG in a Mac, using Quick Look or Preview, does not show the problem.

It looks like the default RAW-development engine suffers from this problem in those devices.