For improving the color calibration on my automated site https://areo.info/mar20 I was looking into Perseverance Rover Mastcam-Z raw PDS images.
On https://an.rsl.wustl.edu/help/Content/About%20the%20data/Data%20products/List%20of%20data%20product%20types%20by%20instrument.htm#M20 I read about the available raw image format for Mar 2020:
ECM: Original Image Product, Possibly Companded (8->12bit)
EDR: Decompanded Image Product
That's misleading as the ECM file, 8 bit image data, contains the data as received on Earth, which means only the sender-side of the companding process was applied, one of the 32 available 12 to 8 bit LUTs.
The EDR file contains the fully companded data, that means 12 to 8 bit LUT conversion as received on Earth and then the correct one of the 32 LUTs reverse applied to receive 12 bit data. That 12 bit data is then apparently linearly stretched to 16 bit, but I'm not sure yet due to the lack of a PDS4 converter tool being able to write 16 bit images on macOS.
My suggestion to avoid confusion here to change the page above as follows:
ECM: Data product as received on Earth with only the sender-side companding applied (12 to 8 bit)
EDR: Data product with linear camera sensor data with the full companding applied (12 to 8 bit on the spacecraft and after reception on Earth 8 to 12 bit)
And depending if the 12 bit data is scaled to 16 bit that additional info as well.