Iso inconsistency between cameras - Script Writing - CHDK Forum

Iso inconsistency between cameras

  • 10 Replies
  • 4549 Views
Iso inconsistency between cameras
« on: 07 / February / 2021, 01:07:38 »
Advertisements
So I played around with the manual video script, and I noticed that iso is inconsistent between cameras

Iso 100 on my SX40 is cleanest, on the S95 it has more noise (and brigher) and on the G1X it has even more noise (and even brighter)

It affects the end result too, not just the liveview

Is there any way to get "true" iso from the S95 and the G1X, or at least make them sync together? it's really frustrating having to deal with this

Top left: S95, Bottom Left: SX40, Bottom Right: G1X
« Last Edit: 07 / February / 2021, 09:32:52 by rustbell »

*

Offline reyalp

  • ******
  • 14131
Re: Iso inconsistency between cameras
« Reply #1 on: 07 / February / 2021, 14:14:21 »
Does this apply to still images with the same settings, or only the video script?

Also if you can identify the specific scripts you are using, that would be helpful. Is it the current one from https://chdk.fandom.com/wiki/Manual_Exposure_Control_for_Video_Recording (with the special variant for g1x)?
Don't forget what the H stands for.

Re: Iso inconsistency between cameras
« Reply #2 on: 07 / February / 2021, 14:53:21 »
Does this apply to still images with the same settings, or only the video script?
This topic was discussed a bit in the CHDK Facebook group.  He tried CHDKplus.lua and the images on the three cameras using the same TV,Sv,AV values all seem to be exposed the same.

Quote
Also if you can identify the specific scripts you are using, that would be helpful. Is it the current one from https://chdk.fandom.com/wiki/Manual_Exposure_Control_for_Video_Recording (with the special variant for g1x)?
That is the script.  We did check that it's not just a problem at the lower ISO settings ( ISO 80 or ISO 100 ).  The exposures are different at ISO 400 for example.

I don't know if the OP noticed the G1X version.


Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14131
Re: Iso inconsistency between cameras
« Reply #3 on: 07 / February / 2021, 17:06:10 »
Two things come to mind:
1) The g1x variant does something with AE lock, so it's possible the regular one doesn't successfully set ISO.

2) How sure are we SetCDSGain works in sv96 units? On my elph130, GetCdsGainValue returns a value that doesn't look like an sv96 to me.

Code: [Select]
# 0xff40bd90,GetCdsGainValue_FW
# 0xff40bef8,GetCdsPreGainReg_FW

=press'shoot_half' repeat sleep(10) until get_shooting() g=call_func_ptr(0xff40bd90) dg=call_func_ptr(0xff40bef8) return g,sv96_to_iso(g),dg,sv96_to_iso(dg)
4:return:151
4:return:9
4:return:6
4:return:3

I noticed there was only a GetCdsGainValue and wondered if the corresponding SetCDSGain and SetCDSGainValue worked in different units, but on both elph130 and g1x, they point to the same function.

I thought the gain value might be in the same units returned by get_current_exp (https://chdk.setepontos.com/index.php?topic=13508.msg137842#msg137842) but in a quick test it appears to be different.
Don't forget what the H stands for.

Re: Iso inconsistency between cameras
« Reply #4 on: 07 / February / 2021, 22:25:34 »
I actually made the G1X version
SX40 version (which I've found on the manual video script thread) added a check to remove AELock after stopping the script (the normal one doesn't remove AELock after stopping the script, thus crashes the camera), G1X version was built on it and added support to f/16
« Last Edit: 07 / February / 2021, 22:34:49 by rustbell »

*

Offline reyalp

  • ******
  • 14131
Re: Iso inconsistency between cameras
« Reply #5 on: 08 / February / 2021, 23:27:54 »
I actually made the G1X version
Good to know.

I looked at this some more, and the bottom line is the value that the script call "ISO" is fed to SetCDSGain as an sv96 value, but SetCDSGain expects some entirely different units. It's likely camera specific, and it only "works" with ISO values in the sense that it's in a log scale and larger values represent higher sensitivity.

G7X references the string "SetAnaDigiGain dB %d\r" from SetCDSGain, which suggests it's a decibel value for the ADC.

G7X has native manual ISO in video, so I used GetCdsGainValue to read back the ISO at several stops. It appears there is about 194 units per stop of ISO:

124 = 34
200 = 168
400 = 362
800 = 556
1600 = 794

These specific values are likely only valid for cameras share the same sensor (g7x and g5x), but I expect others follow a similar form.

You cannot trivially get this relation from GetCdsGainValue in still image mode, because it only reflects what the live view is doing, and even in manual mode, live view trades off live view shutter and gain based on lighting conditions.

As an aside, I also looked at the DeltaSV value (returned by get_current_exp). On G7X, that value appear to be an APEX96 offset from ISO 200 (real and market are identical on this camera).

I also looked at SetDeltaCDSGain, think it might work in the same units as DeltaSV, but it appears to do
SetCDSGain(GetCdsGainValue() + x)

Other functions:
On g7x
GetCdsPreGainReg and GetSensorPreGain both always returned 0. On inspection, they are hard coded and don't actually do anything aside from printing their hard coded values to the console, but they expect a type argument. They do appear to have real code on some other cameras (elph130, for example)

GetCurrentDriveBaseSvValue returned 576 (=ISO200) in all cases on. It has actual code.

Don't forget what the H stands for.

Re: Iso inconsistency between cameras
« Reply #6 on: 09 / February / 2021, 08:48:35 »
I can't understand what you've said. Can you simplify it for me?

Re: Iso inconsistency between cameras
« Reply #7 on: 09 / February / 2021, 14:06:20 »
I can't understand what you've said. Can you simplify it for me?
Basically there is no easy way to set video recording exposure using an ISO value. The existing code is a hack that shifts the sensitivity based on the setting picked but it's not calibrated to an actual ISO value.

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14131
Re: Iso inconsistency between cameras
« Reply #8 on: 09 / February / 2021, 14:08:02 »
I can't understand what you've said. Can you simplify it for me?
Bottom line:
The script is broken. What it calls "ISO" isn't ISO. It's some unknown, camera dependent ADC gain value.

Fudgey actually noted that SetCDSGain didn't use ISO way back in 2010 when the script was developed, but this seems to have been lost since it does adjust ISO to some extent. This probably explains some of the crashing too.

Fixing it requires reverse engineering to find a generic way to convert between gain units and ISO units, or a way to set ISO. The rest of my post reports some initial reverse engineering, in case anyone else wants to work in this area. I'll probably dig into it some more later, because it looks like it should be solvable and potentially useful in some other areas.

In the meantime, if you want to set your cameras to equivalent ISO using the script, you'd have to just figure out the equivalent values by experiment. I'd suggest modifying the script to work directly in the values sent to SetCDSGain instead of running them through ISO conversions. It seems likely that gain should start around 0.
Don't forget what the H stands for.

Re: Iso inconsistency between cameras
« Reply #9 on: 09 / February / 2021, 23:18:25 »
it seems like this script is sensor dependant, because it gives constant result on 2 cameras that have the same sensor (SX10 and SX20) but not the same sensor size (SX20 and SX40 give different results)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal