Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - jkruser

#1
Feature Requests / HDR ISO Shifting finer increments
September 13, 2015, 12:20:41 AM
I have an application for a very large dynamic range shot and wanted to use ISO shifting to get the most out of the camera.  Unfortunately when set to half, I hit ISO limits way before shutter speed becomes an issue. There are about 5 orders of magnitude of shutter speed range, but little more than one worth of usable ISO.  It seems reasonable to have a smaller increment than half.  Ideally a process that gives more control over when and how ISO shifting kicks in could be implemented, but that is beyond the scope of this request.

I have some software experience, but am not at the point that I can fully implement, build, test, and upload a project of this complexity.  With that said, I dug into shot.c and found it should be a reasonably simple process to add a Quarter shift option assuming the ISO rounding math works out.  An "Eighth" option could probably be added as well, but I am starting simple.  I have listed snippets below that would be a start to implementing this, I don't know variable naming conventions so the new name is arbitrary.

I apologize for the long post, but am trying to do what I can to help.  Feel free to ignore it if I am being too presumptuous.

Updates probably needed to shoot.c Changes marked in red

Add menu items under menu_entry shoot_menus[]

                .name = "ISO shifting",
                .priv       = &hdr_iso,
                .max = 3,
                .help =  "Also use ISO as bracket variable. Range: 100 - max AutoISO.",
                .help2 = " \n"
                         "Full: try ISO bracket first. If out of range, use main var.\n"
                         "Half: Bracket with both ISO (50%) and main variable (50%).\n",
                         "Quarter: Bracket with both ISO (25%) and main variable (75%).\n",
                .choices = CHOICES("OFF", "Full", "Half", "Quarter"),
                .icon_type = IT_DICE_OFF,

Under hdr_iso_shift, the existing code takes advantage of an inline statement to select between one of 2 factors. While this is efficient code, it needs to be replaced by a look up table  that sets a division factor (I'll call the new variable hdr_iso_shift_factor) based on the menu item chosen.  "1 Full" needs to be set to 1, "2 Half" needs to be set to 2, and "3 Quarter" needs to be set to 4.  For code organization purposes, this could be put in several different areas.  The code is trivial, but I will assume hdr_iso_shift_factor has already been set by the time the code below runs.


static int hdr_iso_shift(int ev_x8)
{
    hdr_iso00 = lens_info.raw_iso;
    int iso0 = hdr_iso00;
    if (!iso0) iso0 = lens_info.raw_iso_auto;

    if (hdr_iso && iso0) // dynamic range optimization
    {
        if (ev_x8 < 0)
        {
            int iso_delta = MIN(iso0 - MIN_ISO, -ev_x8 / hdr_iso_shift_factor); // lower ISO, down to ISO 100

            // if we are going to hit shutter speed limit, use more iso shifting, to get the correct bracket
            int rs = lens_info.raw_shutter;
            int rc = rs - (ev_x8 + iso_delta);
            if (rc >= FASTEST_SHUTTER_SPEED_RAW)
                iso_delta = MIN(iso0 - MIN_ISO, iso_delta + rc - FASTEST_SHUTTER_SPEED_RAW + 1);

            iso_delta = (iso_delta+6)/8*8; // round to full stops; also, prefer lower ISOs
            ev_x8 += iso_delta;
            hdr_set_rawiso(iso0 - iso_delta);
        }
        else if (ev_x8 > 0)
        {
            int max_auto_iso = auto_iso_range & 0xFF;
            int iso_delta = MIN(max_auto_iso - iso0, ev_x8 / hdr_iso_shift_factor); // raise ISO, up to max auto iso
            iso_delta = (iso_delta)/8*8; // round to full stops; also, prefer lower ISOs
            if (iso_delta < 0) iso_delta = 0;
            ev_x8 -= iso_delta;
            hdr_set_rawiso(iso0 + iso_delta);
        }
    }
    return ev_x8;
}

I'm not quite sure whats going on in MENU_UPDATE_FUNC and why ISO needs to be capitalized for "Full" option 1 and lower case for "Half" Option 2.  For a new "Quarter" option 3 setting this to ISO or iso would aid consistency, or all of them could be updated to reflect the actual setting more closely.

        MENU_SET_RINFO("%s%s%s",
            hdr_sequence == 0 ? "0--" : hdr_sequence == 1 ? "0-+" : "0++",
            hdr_delay ? ", 2s" : "",
            hdr_iso == 1 ? ", ISO" : hdr_iso == 2 ? ", iso" : hdr_iso == 3 ? ", ISO" : ""
        );

Now for the obligatory thanks to all of the Devs, yes, this is my first post, but I have been a long time user and love the work being done on the 70D branch.  I have always found what I needed with the search and just now had a real need to create an account.