I am implementing a vision project, and want to save disk space by converting the 12-bit linear raw files to 10-bit log Adobe DNG files.
I went though the DNG document but could not find the formula or matrix to convert from 12-bit linear RAW to 10-bit log DNG.
Can someone kindly offer these details ?
Within the DNG spec, that is handled by creating a LinearizationTable. However, be aware that writing 10-bit values to a file in a way that uses less than 2 bytes may be tricky; while in principle DNG inherits support for packed formats from TIFF, my recollection is that the DNG SDK doesn't actually implement the ability to write such files, although I think it can read them.
I'm glad you mention the issues with packing bytes.
I had 12-bit RGGB raw saved as a DNG, but the colors were off.
The byte order in Adobe is different and seems to be undocumented.
I had not problems with 8-bit RAW converted to DNG.
I have code that writes packed data, but it would be nice to access the way that DNG expects the packed data to be written.
For 10-bit, I would be looking at 4 pixels in 5 bytes. I am unaware of any packing that would allow this, and if Adobe DNG actually supports this.
At least with 12-bit, 3 pixels in 2-bytes, there seems to be support - however, the actual pixel order is unknown.
I will go through the Linearization tables in the DNG spec now.