### Author Topic: Auto exposure algorithm for shooting - auto iso, ae (autoexpo.mo)  (Read 223094 times)

#### pravdomil

• Member
• Posts: 166
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #75 on: August 14, 2013, 09:04:16 PM »

#### RenatoPhoto

• Moderators
• Hero Member
• Posts: 1509
• 5DM3 / 7D
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #76 on: August 14, 2013, 09:08:56 PM »
https://maps.google.com/maps?saddr=Prague,+Czech+Republic&daddr=Quito+Ecuador&hl=en&sll=37.0625,-95.677068&sspn=57.249013,73.652344&oq=Pragu&mra=ls&t=m&z=3
Code: [Select]
We could not calculate directions between Prague, Czech Republic and Quito Canton, Ecuador.

Ha Ha

Faulty Code!  You have to take a plane, land in Quito and call me 0991914333.  I will come and pick you up!  Bring Alex and G3GGo with you too!
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

#### pravdomil

• Member
• Posts: 166
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #77 on: August 14, 2013, 09:11:21 PM »
Then I turn on module ON and press the LV button to go to life View.
no LV! How do you figure that?

I need to aim at bright light and press the half shutter, then put cap on and press half shutter.
turn mem_spy ON, wait 10s, hold halfshutter and watch what it changing, still hold halfshutter don't unpress it until you find correct value

How many memory locations should I find?  I assume that the mem locations are like 2d2cc?
as I said
Quote from: pravdomil
set setting - halshutter related on, look for int16, range of adress 0x0 - 0x20 000, changes 20 - 300

Then there is two colums of numbers and a mem location, then two colums.
addr TAB num of changes TAB value

good luck!

#### RenatoPhoto

• Moderators
• Hero Member
• Posts: 1509
• 5DM3 / 7D
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #78 on: August 14, 2013, 09:15:53 PM »
Ok, I am not a programer but can read numbers.  I am an engineer so I will look into this later, I have to go now to the airport to pick up Nanomad and Audionut and others...  Just kidding.  Bu I do have to go to airport to get customers.
Thanks
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

#### pravdomil

• Member
• Posts: 166
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #79 on: August 14, 2013, 09:48:14 PM »
it's easy, you don't have to be a programmer

some detailed instructions
turn you camera on
set M mode
go to mem_spy settings in debug menu
set look for int16 (maybe int8), halshutter related on, range of adress 0x0 - 0x20 000, changes 20 - 300, other options should be turned off
turn mem_spy on
wait 10s and go to info screen (dont press halfshutter)
hold halfshutter until you find correct value
20x changes scene brightness
some variables will occur
look at the values in every third column how they react on scene brightness
if you have some suspicious, look at the exposure compensation and analyze what values have 0EV +1EV -1EV

if you will testing for long time some variables will hide, that's max 300 changes limit, in other word if you 300x changes you exposure our variable will hide (~ 2 changes in second on 5D2)

on 5D2 and 5D3

look at these images should get 1EV and your value 2049 or -1EV value 2047

#### pravdomil

• Member
• Posts: 166
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #80 on: August 14, 2013, 10:17:32 PM »
I have to go now to the airport to pick up Nanomad and Audionout and others...
G3GGo is from Germany and A1ex I think form Romania (not sure), Nanomad from Italia, Audionut dont know
we should make some ML party and find BV value on 5D3!

#### ed.jenner

• New to the forum
• Posts: 33
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #81 on: August 14, 2013, 11:51:49 PM »
For me this seems like the almost-perfect 'auto' shooting control.  It takes some playing with to figure out initially what settings are going to work for particular situations, so I imagine you will get a lot of 'how do I use this' from people that don't have the patience to play with it for a while after which it makes total sense.

Of course the first 30mins I tried to use it  I had 'Exposure Lock' on and that did all sorts of strange stuff.  Made me wonder if there is a protocol for ML modules not trampling/fighting on each other.  Might become more of an issue as people add more individual modules, even if we are supposed to be power-users and know what we are doing!

I also don't understand why someone would need it to work in anything by Manual mode because you can set both Av and ISO to a particular value (min=max) and have anything else change exactly as you specify.  I guess you can fix Shutter Speed if you specify the appropriate Av and ISO changes, but in any case I think the minimum is enough and what most people would want the options the way they are.

Now you did mention Exposure Compensation in the first post and I would love to see this because I'm nearly always shooting the 5DII at +1/3 to +1EC.  Without that I basically have to accept that I'm going to be under exposing up to a stop from where I want to be.   Even with changing light, if I'm in Av then I often just leave the EC at +1/3 or +2/3 (1/2 stop increments in EC would be just fine too).

With that and several hours of practice at moving the curves around, the only remaining issue is that it is almost as far removed from 'auto' as one could imagine (in the best way possible).  It's like a real 'P' where you actually program what you want the camera to do depending on the light.

With EC I'd shoot everything but landscapes (for which I use LV and M) using this module.

#### pravdomil

• Member
• Posts: 166
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #82 on: August 15, 2013, 01:15:58 AM »
For me this seems like the almost-perfect 'auto' shooting control.
It's like a real 'P' where you actually program what you want the camera to do depending on the light.
definitely, this is meant as perfect auto exposure algorithm
I never have to set my exposure

It takes some playing with to figure out initially what settings are going to work for particular situations, so I imagine you will get a lot of 'how do I use this' from people that don't have the patience to play with it for a while after which it makes total sense.
true, maybe some video tutorial where will be explained, basic of exposure, APEX system and finally Auto exposure module (curves, ranges, limits)
this is warning for people that don't understand what auto expo do, please play with it for weeks before asking

I also don't understand why someone would need it to work in anything by Manual mode
agree

Now you did mention Exposure Compensation in the first post and I would love to see this
I have already think of it and I have some idea
another case - I need shoot low light scenes underexposed as they are (it can be done by setting minimum shutter value, but it is not cleanest sollution)
so EC will be just next curve
I will add
EC value (which will constantly decrease or increase EC curve)
EC range (min - max)
EC curve (at BV +/- EV per BV)

thanks for feedback

#### chris_overseas

• Moderators
• Member
• Posts: 234
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #83 on: August 15, 2013, 03:48:32 AM »
I've been trying to track down the memory location on the 5D3. So far I've found:

0x268DC - changes when rolling the rear dial.
0x2E770 - changes when rolling the rear dial.
0x2E780 - changes with the scene's brightness. Values are between -7000 and +9000 or so.
0x2E7C0 - ranges between 250 and 500 or so. Doesn't seem to map to brightness directly but is somehow related.
0x323F8 - possible?
0x323EC - possible?

I tried copying the 5D2 code that's in consts.h and using the address 0x2E780 but that froze the screen (top LCD and camera buttons still worked, wouldn't take a photo). I was going to play further but my camera batteries all need charging and it's 2:30am. Will try some more tomorrow.

In the meantime, I have a couple of questions:
What range of values should I be looking for? Is -7000 to +9000 reasonable?
How do I know whether to look for an int16 or an int8? It seems the 5D2 is an int16 but all other Canon cameras are int8?
When I think I've found the right address, what exactly should I do to test it?

Apologies for my lack of understanding, I'm new to this.

One small bug I noticed in mem_spy. The call to bmp_fill() should take FONT_SIZE rather than a hard-coded 12 (I noticed this because I had to make the font bigger so I could read the output!).
EOS R5 1.1.0 | Canon 16-35mm f4.0L | Tamron SP 24-70mm f/2.8 Di VC USD G2 | Canon 70-200mm f2.8L IS II | Canon 100-400mm f4.5-5.6L II | Canon 800mm f5.6L | Canon 100mm f2.8L macro | Sigma 14mm f/1.8 DG HSM Art | Yongnuo YN600EX-RT II

#### Audionut

• Global Moderator
• Hero Member
• Posts: 3657
• Blunt and to the point
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #84 on: August 15, 2013, 04:08:59 AM »
0x2E780 - changes with the scene's brightness. Values are between -7000 and +9000 or so.

This one is 2049 at EC+1.

#### Audionut

• Global Moderator
• Hero Member
• Posts: 3657
• Blunt and to the point
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #85 on: August 15, 2013, 05:05:35 AM »
Looks like I got it working on the 5D3.  I'll create a pull request shortly.
Camera freezes as chris_overseas notes above when "Lock ISO & AV" is set to off.

@pravdomil

Can we stop it using digital ISOs?  Confine it to ISO 100, 200, 400, 800, etc.

EC adjustment will be very handy.

Also the ability to link maximum aperture to Canon menu (like shutter in AutoETTR).  This way I can lock aperture to f/2.8 most times (sharpest for lens and reasonable DOF), but the option to adjust aperture to f/1.4 for low light situations and have the ISO curve respond like so,

#### pravdomil

• Member
• Posts: 166
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #86 on: August 15, 2013, 10:50:49 AM »
you find it!
https://bitbucket.org/hudson/magic-lantern/pull-request/180/autoexpo-working-on-5d3/

Camera freezes as chris_overseas notes above when "Lock ISO & AV" is set to off.
will be fixed as soon as possible
I don't know what is not working

Can we stop it using digital ISOs?  Confine it to ISO 100, 200, 400, 800, etc.
not yet, I will add a option
for now you can use round values at eg. at 3 + 1 EVpBV (APEX theory)

EC adjustment will be very handy.
I will add it

This way I can lock aperture to f/2.8 most times (sharpest for lens and reasonable DOF), but the option to adjust aperture to f/1.4 for low light situations
well this is in todo list, you want two point curve

#### Audionut

• Global Moderator
• Hero Member
• Posts: 3657
• Blunt and to the point
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #87 on: August 15, 2013, 11:26:53 AM »
well this is in todo list, you want two point curve

2 is good.  More is always better

Thanks.

#### Stedda

• Hero Member
• Posts: 504
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #88 on: August 15, 2013, 11:36:47 AM »
Sweet! Is it fully working on 5D3?
5D Mark III -- 7D   SOLD -- EOS M 22mm 18-55mm STM -- Fuji X-T1 18-55 F2.8-F4 & 35 F1.4
Canon Glass   100L F2.8 IS -- 70-200L F4 -- 135L F2 -- 85 F1.8 -- 17-40L --  40 F2.8 -- 35 F2 IS  Sigma Glass  120-300 F2.8 OS -- 50 F1.4 -- 85 F1.4  Tamron Glass   24-70 2.8 VC   600EX-RT X3

#### RenatoPhoto

• Moderators
• Hero Member
• Posts: 1509
• 5DM3 / 7D
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #89 on: August 15, 2013, 02:54:38 PM »
0x2E780 - changes with the scene's brightness. Values are between -7000 and +9000 or so.

This one is 2049 at EC+1.

Yes,  Confirmed at mem location: 0x2E780
EC=-1 get -2047
EC=0  get 0
EC=+1 get 2049
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

#### pravdomil

• Member
• Posts: 166
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #90 on: August 15, 2013, 03:02:38 PM »

#### 1%

• Developer
• Hero Member
• Posts: 5936
• 600D/6D/50D/EOSM/7D
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #91 on: August 15, 2013, 03:24:38 PM »
Quote
Can we stop it using digital ISOs?  Confine it to ISO 100, 200, 400, 800, etc.

On 50D, except for 100 those are digital ISOs. I suspect 5DII(550D?500D?) may be similar.

#### Audionut

• Global Moderator
• Hero Member
• Posts: 3657
• Blunt and to the point
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #92 on: August 15, 2013, 04:06:12 PM »
On 50D, except for 100 those are digital ISOs. I suspect 5DII(550D?500D?) may be similar.

If 100 is analog, so is every multiple.  I'd say the registers are backwards for some reason on the 50d, if my memory of your dualISO work is true.

In photo mode, the in camera digital manipulation is burned into the cr2.  You can observe the results with a raw analyzer.

I rambled about digital ISOs here.

#### RenatoPhoto

• Moderators
• Hero Member
• Posts: 1509
• 5DM3 / 7D
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #93 on: August 15, 2013, 06:05:20 PM »
it should be 1
Correct at EC=0 mem=1

mem_spy is a nice tool!
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

#### pravdomil

• Member
• Posts: 166
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #94 on: August 15, 2013, 11:28:24 PM »
2 is good.  More is always better
have you idea how it can be done? what menu gui

#### Audionut

• Global Moderator
• Hero Member
• Posts: 3657
• Blunt and to the point
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #95 on: August 16, 2013, 12:08:05 AM »
No. Perhaps it's best to leave it as a 2 point curve option.

It doesn't solve my need for quick user adjustment of maximum aperture though.  User should be able to control DOF while having the shutter/ISO curves respond accordingly.
And I guess the same for shutter control (not one I use except for minimum).  User adjusts shutter and other curves respond.
Either as an option in prefs in M mode, or automatically in Av/Tv modes.

No idea how to do that either, that's way above my pay grade.

Note:  line 317
Code: [Select]
help = "Use main dial for maximum and left & right for minimum."
Should read the opposite way,
Code: [Select]
help = "Use main dial for minimum and left & right for maximum."

#### pravdomil

• Member
• Posts: 166
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #96 on: August 16, 2013, 12:35:55 AM »
User should be able to control DOF while having the shutter/ISO curves respond accordingly.
User adjusts shutter and other curves respond.
well this is very hard to implement, you have to define all dependencies, I don't really know how to do that
if you will do some research, some excel file with graphs, it can be our starting point
for now I don't care about DOF and shutter, I only use setting in the first post
I don't know if I should implement 2 point curve

Note:  line 317
Should read the opposite way,
thanks I will switch it

#### 1%

• Developer
• Hero Member
• Posts: 5936
• 600D/6D/50D/EOSM/7D
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #97 on: August 16, 2013, 04:07:39 AM »
Quote
If 100 is analog, so is every multiple.

Why? 100 is always like 00. It changes ISO registers on the intermediates not on the 100s. So the register is already changed at 1250 and is no different at 1600, etc. On other cameras ISO 160 is ISO 200 with gain turned down. Here the next change is ISO 320.

#### Audionut

• Global Moderator
• Hero Member
• Posts: 3657
• Blunt and to the point
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #98 on: August 16, 2013, 04:53:22 AM »
Think photography stops.  Did you find the SHAD_GAIN register (a1ex pdf page 4)?

#### Audionut

• Global Moderator
• Hero Member
• Posts: 3657
• Blunt and to the point
##### Re: Auto exposure algorithm for shooting - auto iso, ae
« Reply #99 on: August 16, 2013, 05:18:36 AM »
@pravdomil

If you enable in Av/Tv modes, couldn't you apply the maths from a fixed (user set) aperture/shutter?

Code: [Select]
if mode = Av / get_aperture_from_canonSomething along those lines?

Shutter value should always be reduced first for (best) quality, before raising ISO, +1.0 EVpBV
In Tv, aperture value should always be reduced for (best) quality before ISO, -1.0 EVpBV.  In Tv mode have the user ability to set minimum aperture value (this will keep people happy).
http://forums.whirlpool.net.au/archive/1988678

Now I remember why I ditched Canon Av/Tv modes, Canon autoISO uses digital ISOs, even when custom function is full stop ISOs ffs.

edit:  Haven't had a chance to look at this yet, but here is a LV calculator.
http://www.pentaxforums.com/forums/photography-articles/88197-excel-2003-lv-light-value-calculator.html

re 2 point curve.  Maybe see what interest it receives before spending coding time.