DotTune AFMA (

Started by Kent, February 20, 2013, 06:17:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Quote from: 1% on March 04, 2013, 04:05:29 PM
But is "all lenses" scaled across focal length too?

My understanding is that option sets a consistent AFMA.  ie:  it always adjusts by that amount regardless. 

Just a way of adjusting for the body itself imo.


Will have to test a bunch of lenses at correct lighting/FL and see what happens. Have to pull the newest commit.

I only got 0 on one lens, tokina 50-150 aiming outside.


Quote from: 1% on March 04, 2013, 04:05:29 PM
But is "all lenses" scaled across focal length too? Lots of little quirks it seems.
Not sure, but I would think yes (for zooms).

Another curious question is how Canon's firmware handles a per-lens wide/tele value of 0. The 5DM3 manual says firmware will scale for zooms even if only the wide or tele tune value is how does their firmware distinguish a user-specific tune value of 0 vs a non-set (unassigned) tune value, which is also represented as zero in the menu? Would seem they would need an assigned/unassigned bit somewhere, otherwise the firmware would always scale on the "non-configured" end to 0, which should be quite different than scaling when both the wide/tele are set to identical values. Based on these uncertainties I would strongly suggest owners to always tune both the wide and tele ends.


Maybe need to find out where the actual value ends up in the FW besides the property.


I just did fairly comprehensive testing of dot-tune/ML on my 50D, using The results are reported here:

In particular,

Quote- ML implementation of dot-tune is not perfect yet - at the edges of the good interval, I could see the delay in AF confirm light, sometimes double beep (all these should be discarded according to the Dot-tune author, but ML would apparently still consider them okay, and count them in). Meaning - you can do slightly better if instead of using ML, just do dot-tune manually. But I am sure this will be addressed quickly in the future releases of ML.


These values are still considered, but they have a much lower weight. So, if your lighting conditions or contrast are poor, it will still work.


Thanks - but wouldn't lower weight be reflected in shorter bars in the MFA progress diagram? When I get less-than-good AF confirmation, I can still see the bar having the same height as for good MFA values.


Didn't notice this...


Quote from: pulsar124 on March 04, 2013, 05:57:23 PM
I just did fairly comprehensive testing of dot-tune/ML on my 50D, using The results are reported here:

In particular,

Thanks for your observations, they're greatly appreciated.

Regarding ML's DotTune and how it may sometimes miss the multiple confirmations  for the outlier tune value values, there are two possible strategies at work here, one which is used by the manual DotTune process and one used by ML's DotTune.

In the manual process the user is instructed to hold AF for 5 seconds, which catches > 90% of the multiple AF confirmations that should be excluded from the tuning range. This strategy is important because the manual techique is based around a decisive determination of indivudal tune values in a "single pass".

The second strategy, which is used by ML, is to decrease the sampling duration but increase the sampling frequency. Instead of waiting 5 seconds to detect multiple confirmations at each tune value, ML waits for only 500ms (1/2 second). But ML does 4 "sweeps" (passes), which means 4 500ms samples, for a total of 2.5 seconds of sampling. Multiple-confirmations occur at irregular intervals into an AF hold, so a tune value may produce multi-confirmations at 3 seconds into the AF hold on one sample but at only 300ms into another. In practice it roughly works out to about the same, and because ML's DotTune uses a weighted algorithm for the final tune value determination, it will properly demote tune values which had one or more multiple-confirmation samples relative to values which had no multiple-confirmation samples. That's not to say ML will not sometimes fail to exclude a tune value that a thorough manual DotTune would otherwise catch. There's always room for improvement. It's a balance between expediency and accuracy. ML DotTune could increase the sampling duration to catch maybe 30-50% more multiple-confirmations per sweep, but with 4 samples it wont affect the final result in the majority of DotTune cases.


Thanks for the detailed response! But this begs a suggestion - would it be possible to let the user choose both the number of passes and the duration of one measurement, from the ML menu?


Quote from: pulsar124 on March 04, 2013, 06:28:31 PM
Thanks for the detailed response! But this begs a suggestion - would it be possible to let the user choose both the number of passes and the duration of one measurement, from the ML menu?
I've considered that, exposing the low-level algorithm parameters to the user in the menu. It would be up to Alex. There would actually be three parameters:

1) Total number of passes
2) Maximum period allowed (ms) before first AF confirmation must occur. This is to catch delayed confirmations that should be excluded. This is currently hard-coded at 200ms
3) Minimum period (ms) that AF confirmation must sustain without any dropouts. This is to catch multiple confirmations that should be excluded. This is currently hard-coded at 500ms.

Instead of exposing these parameters it might be more user-friendly to define a "Fast" vs "Slow" option, the former using the current thresholds and the latter using expanded thresholds.


Either way, that would be an improvement. More power to users is always a good thing!


QuoteMore power to users is always a good thing!




Another benefit of exposing the raw parameters is that it can help with debugging any body/lens-specific ML DotTune issues.


Alex, here is logic that can make the algo parameters tunable if you'd like to go that route. I couldn't get a submenu-within-a-submenu working so these options are at the same menu level as the others:

top of module:
static CONFIG_INT( "dottune.number_scans", dottune_number_scans, 2);
static CONFIG_INT( "dottune.max_time_10ms_initial_af_confirm", dottune_max_time_10ms_initial_af_confirm, 200/10);
static CONFIG_INT( "dottune.min_time_10ms_sustain_af_confirm", dottune_min_time_10ms_sustain_af_confirm, 500/10);

// we have to wait until the AFMA change is operated into Canon firmware
static int afma_ack = 0;


    for (int k = 0; k < dottune_number_scans; k++)
        for (int c = 0; c <= 80; c++) // -20 ... 20 and back to -20
            int i = (c <= 40) ? c-20 : 60-c;
            set_afma(i * range_expand_factor, afma_mode);
            int fc;
            // initial focus must occur within quick period to exclude AF confirm lags
            fc = wait_for_focus_confirmation_val(dottune_max_time_10ms_initial_af_confirm*10, 1);
            if (fc)
                // weak or strong confirmation? use a higher score if strong
                // focus must sustain for long period be considered strong
                if (!wait_for_focus_confirmation_val(dottune_min_time_10ms_sustain_af_confirm*10, 0))
                    // focus sustained
                    fc = 3;
            score[i+20] += fc;
            afma_print_status(score, range_expand_factor);
            if (!HALFSHUTTER_PRESSED)
                set_afma(afma0, afma_mode);
                NotifyBox(2000, "Canceled by user.");

Bottom of module:
static MENU_UPDATE_FUNC(dottune_max_initial_af_confirm)
    MENU_SET_VALUE("%d ms", dottune_max_time_10ms_initial_af_confirm * 10);
static MENU_UPDATE_FUNC(dottune_min_sustain_af_confirm)
    MENU_SET_VALUE("%d ms", dottune_min_time_10ms_sustain_af_confirm * 10);

static struct menu_entry afma_menu[] = {

And added menu options:
                .name = "AFMA mode",
                .priv = &afma_mode_index,
                .select = afma_mode_toggle,
                .min = 0,
                #ifdef CONFIG_AFMA_WIDE_TELE
                .max = 3,
                .max = 2,
                .choices = CHOICES(
                    "All lenses",
                    #ifdef CONFIG_AFMA_WIDE_TELE
                    "This lens, wide/prime",
                    "This lens, tele"
                    "This lens"
                .help  = "Where to apply the AFMA adjustment.",
                .icon_type = IT_DICE_OFF,
                .name = "No. range scans",
                .priv = &dottune_number_scans,
                .min = 1,
                .max = 99,
                .help  = "Larger values increase sample size.",
                .name = "Max 1st AF confirm(ms)",
                .priv = &dottune_max_time_10ms_initial_af_confirm,
                .min = 10/10,       /* 10ms */
                .max = 10000/10,    /* 10 seconds */
                .update = dottune_max_initial_af_confirm,
                .help  = "Smaller values are more discerning.",
                .name = "Min cont AF confirm(ms)",
                .priv = &dottune_min_time_10ms_sustain_af_confirm,
                .min = 10/10,       /* 10ms */
                .max = 30000/10,    /* 30 seconds */
                .update = dottune_min_sustain_af_confirm,
                .help  = "Larger values are more discerning.",


I just recently re-ran the test form my 50mm 1.4 lens using All Lenses and got an AF microadjust of -1 ... does that mean it will adjust all of my lenses by -1?  I also went into the C.FnII:Autofocus Canon Menu and I can see where it adjusted 'All by the same amount.  Should I go into 'Adjust by Lens' to customize it per lens?

Thanks ... just trying to understand the process.
6D | Tamron 24-70 f/2.8 | EF 50 f/1.4 | EF 70-300 f/4-5.6 | Canon EF 100mm f/2.8 L


Yes, it will adjust all lenses. Also when using individual lens adjustments register lens first in canon menu. There is another value in the property that changes when this happens and I don't think afma is accounting for it.



Mainly folks need to read & research. I try... sometimes excitement gets the best of me and I end up with more problems at the end, not to much for ML but other stuff I jump into. Like a new platform (android/wrt), etc.


Roger Cicala is the founder of LensRentals, and very knowledgeable about MFA. LensRentals has dozens (hundreds?) of cameras and thousands of lenses. He might be willing to get involved in testing automated MFA. I'll check with him.


This is great, and amazing work.  I feel another donation coming ML's way.  This will be a time saver for sure when testing lenses, especially if I buy a new lens.


I cant wait to try this out in my 7D when alpha 3 arrives.

Are you guys aware of this application:

They now can do calibration without flicking the mirror per shot.

They also publish statistics (based on automated user reports) on different lens/house combinations:

I have used it a lot, and I have come to the conclusion that AFMA is difficult. My 70-200 needs one AFMA setting at 120mm or so, another setting at the ends (meaning that even a 5Dmk3 would have to few parameters). The choice of defocusing method ("near" or "far") seems to have some significance sometimes, with some lenses. I have done extensive testing, saying to my self "now everything is as good as it can be", only to repeat under slightly different conditions and getting equally conclusive measurements pointing in another direction...



How can i load it on a 5D3 as shown in the video?
Nightly builds shows only the 2.3 supported cameras.

Thanks in advance!


my first post here, thx much for implementing this feature,

i have load my 5dii with the regular build and then loaded the latest nightly build,

i am running into trouble running the AFMA option. i focus manually using the 10x, set the lens to manual focus and choose the menu option -20 +20 and the info screen comes up, blinks couple times and it says repeat the process again and stays in that loop, what i am doing wrong?