Getting live view exposure (was Re: Improving CHDK ND filter support) - page 3 - General Discussion and Assistance - CHDK Forum supplierdeeply

Getting live view exposure (was Re: Improving CHDK ND filter support)

  • 25 Replies
  • 18143 Views
*

Offline reyalp

  • ******
  • 13434
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #20 on: 28 / December / 2018, 17:04:20 »
Advertisements
On EOS M3 the "ShowCurrentExp_FW" function prints  the Gain value in the range -96...480.
Does anybody found the way to change this gain? This could be usefull for FRSP.
FWIW, I investigated the "gain" values a while back:  https://chdk.setepontos.com/index.php?topic=13508.msg138135#msg138135

get_current_exp is what I called the function called by ShowCurrentExp.

I haven't found a way to set it or convert directly to normal ISO values.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 13434
Re: Iso inconsistency between cameras
« Reply #21 on: 10 / February / 2021, 01:21:01 »
edit: merged from https://chdk.setepontos.com/index.php?topic=14231.0

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)
Yep. It's unsurprising that cameras with very similar or identical sensor hardware are the same. It's unsurprising that others are different, especially CCD vs CMOS.

Back to the reverse engineering:
On cameras with manual still mode, you can determine the gain to ISO relationship, as long as you make sure the live view shutter speed from get_current_tv96() doesn't change. The camera prefers certain shutter speeds for live view (to prevent reducing frame rate, for example) so this is doable. Cameras without a manual mode are still problematic.

Doing this on sx710, the each ISO stop again corresponds to about 194 in gain units.
get_current_exp DeltaSV + GetCurrentDriveBaseSvValue (=200 market) again gives the ISO value.

This allows conversion:
sv96_to_gain(sv96) => (194/96)*sv96 - known_sv96_value*(194/96) + corresponding_known_gain_value
gain_to_sv96(gain) => gain*(96/194)  + known_sv96_value - corresponding_known_gain_value*(96/194)

The known values account for the zero points of the different systems, so the specific values don't matter as long as they represent the same ISO setting. That leaves only the size of a gain stop (194 for sx710 and g7x) as not directly implementable with known functions.

I had hoped that SetCDSGain would update the DeltaSV value, but it appears not to.

edit:
According to the above, the gain 0 on sx710 would be about sv96 320, or ISO market 50 (significantly lower than the lowest normal ISO). There is a visible difference between gain 0 and gain 10. Negative values appear identical to 0.
5000 crashed:
Code: [Select]
ASSERT!! DegeenAccs.c Line 389
Occured Time  2021:02:09 22:57:29
Task ID: 17039397
Task name: PhySw
« Last Edit: 14 / February / 2021, 19:13:23 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 13434
Re: Re: Iso inconsistency between cameras
« Reply #22 on: 12 / February / 2021, 01:00:04 »
I noticed function SetCDSGainStep associated with the string "SetCDSGainApex %d" (again  :-[) which sounds a lot like setting gain using sv96 units.

Investigating on sx710
It only works if the registration eventprocs 'FA.Create' and 'InitializeAdjustmentSystem' have been called. Calling the function directly (with appropriate pass by reference for the value) has no effect, likely because it depends on other stuff being initialized.
It sets the live view / video gain in sv96 units, relative to GetCurrentDriveBaseSvValue.
It appears to at least mostly work in AE modes, effectively locking live view AE. However, I did get a few "ASSERT!! BrtMthd.c Line 3927" crashes while messing with it. In AE modes, it updates the get_current_exp deletasv value. If AE is locked, it doesn't. It appears to work while recording video.

This suggests that videoexp3.lua could be made to work in proper ISO values by replacing
Code: [Select]
call_event_proc("SetCDSGain",sv96)
with
Code: [Select]
call_event_proc("SetCDSGainStep",sv96 - call_event_proc("GetCurrentDriveBaseSvValue"))

GetCurrentDriveBaseSvValue is only an eventproc on newer cameras (starting with DryOS 49), although the underlying function appears to exist back to digic 2 vxworks. The eventproc is also not present on the EOS M cameras.


Some other notes:
I did some testing sx160 (digic 4 + CCD)
GetCurrentDriveBaseSvValue seems to always be 795 (ISO market 1600), although I've only tested with indoor lighting (edit: tested in direct sun, same).
Gain appears to be 167 per sv96 stop, although the first stop from ISO 100 to 200 was was only 112 gain and 64 sv96 (we've seen the first stop being wonky in manual ISO before). In both cases it works out to roughly 1.75 gain units per sv96 unit.
This puts 0 gain at about ISO 270.

In the sx160 firmware GetCdsPreGainReg is equivalent to GetSensorPreGain(0). I tried passing 0-10 to GetSensorPreGain, and it always returned 6.

I verified that get_current_tv96() + get_current_av96() - (deltasv + GetCurrentDriveBaseSvValue()) is roughly equal to the reported Bv in half press, for both sx160 and sx710.

The sx160 ISO values seem high, but the shutter speeds are correspondingly high going to to 1/10000 looking directly at a light. I suspect the live view mode is heavily binned.

It would be interesting to know how much of the difference between sx160 and sx710 is CCD vs CMOS or digic 4 vs digic 6. I suspect mostly the former, but all my digic 6 cams are CMOS and all my earlier ones are CCD.

Older cameras (through DryOS 23) have ImgGainTool.* eventprocs, which appear to provide some related functionality. In particular ImgGainTool.GetUserGainLimit  and GetDeltaGainLimit might show us how to get acceptable ranges.
« Last Edit: 13 / February / 2021, 14:18:38 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 13434
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #23 on: 14 / February / 2021, 22:16:50 »
Working on this more:
Confirmed the deltasv value  + GetCurrentDriveBaseSvValue gives something that appears to be the live view ISO value on all my cams.

I've added matches for these to the sig finders in r5731. I called the deltasv function get_current_deltasv to be consistent with get_current_exp. These are currently unused, but I'll probably expose them as script functions to go with get_current_tv96 and get_current_av96.

GetCurrentDriveBaseSvValue
a540: sv96 603 (real), ISO 400 (market)
d10: 659, ISO 599
sx160, elph130, elph180: 795, ISO 1600
g7x, sx710, sx730: 507, ISO 200

The conversion from gain units to sv96 varies:
a540 = 166/96 = ~1.73
d10, elph130, elph180, sx160 = ~1.75
g7x, sx710, sx730 = 194/96 = ~2.02

On Digic 7 M cameras (M100, M5, M6), GetCdsGainValue is just a return instruction. On g7x2, it looks like the D6 cams. There are a bunch of other gain related functions on the M cams, like
GetCMOSGainValue_FW
GetCMOSGaindBValue_FW
GetDegeenGaindBValue_FW
GetDfeGainValue_FW
GetCMOSOddGainValue_FW
GetCMOSEvenGainValue_FW
GetCMOSOddGaindBValue_FW
GetCMOSEvenGaindBValue_FW
GetDfeGaindBValue_FW
Many of these exist on the d6 M cameras as well.

Don't forget what the H stands for.


*

Offline reyalp

  • ******
  • 13434
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #24 on: 20 / March / 2021, 00:09:57 »
These are currently unused, but I'll probably expose them as script functions to go with get_current_tv96 and get_current_av96.
I added these in trunk 5792, as get_current_delta_sv96 and get_current_base_sv96.

On all my cameras base+delta appears to give "real" sv96 used by live view.

If the sensor is off they appear to return most recent value. In playback before going to rec they return low values like base = 507, delta = -3072

chdkptp query to return sv96 values and "market ISO" for base and combined
Code: [Select]
=b,d=get_current_base_sv96(),get_current_delta_sv96() return b,d,sv96_to_iso(sv96_real_to_market(b)),sv96_to_iso(sv96_real_to_market(b+d))
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1157
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #25 on: 20 / March / 2021, 02:56:29 »
GetCMOSOddGainValue_FW
GetCMOSEvenGainValue_FW
GetCMOSOddGaindBValue_FW
GetCMOSEvenGaindBValue_FW

What do even and odd stand for?
Dual Pixel? Dual ISO?
M100 100a, M3 101a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

 

Related Topics