ISP Gamma Settings Don't Seem Right

I need to match camera data taken with different exposure times, and have been debugging the ISP pipeline to make sure I have it correct in a radiometric sense. By using nvgstcapture I can capture both RAW and JPEGs of the same scene. The RAW data is very linear and very repeatable (I take data of a stable light source at a series of exposure times and plot the pixel values vs. exposure time). The black level of the sensor (using a Sony IMX274) is correctly measured and matches the value in the ISP settings file.

When I look at the JPEGs however, if I apply a gamma correction by scaling the data from 0…1 and raising to the power of gamma (specified as 2.4 in the ISP settings file), the data is not quite linear. I have errors on both the high and low end of the scale. When I use a gamma of 2.0 its much better, but still not as good as the raw sensor data. I understand that there may be some compression artifacts etc. involved.

Is there any documentation available on the pixel processing operations in the ISP? I’m doing this for calibration purposes, and imagine this would be generally useful for people using multiple exposure systems or multi-camera systems. Is the gamma applied without any toe? i.e. sRGB uses a slightly linear region near zero when mapping linear light values to a gamma corrected space. When I use gamma of 1.0 its also slightly off (I know its having an effect as I have to adjust the gamma I use to undo the gamma applied as well). The only intensity level change I do is subtract the black level of the sensor. The demosaicing and color-correction are linear processes (or so I’m assuming) so shouldn’t affect overall system linearity.

Hi stmpixels
You need scaling partner for the image tuning for get better image quality.