示例#1
0
void shooting_set_autoiso(int iso_mode)
{
    short max_iso;

    if (iso_mode<=0)
        shooting_recalc_conf_autoiso_values();

    switch (iso_mode)
    {
    case -1: // ISO HI
        //max_iso = conf.autoiso_max_iso_hi*10;
        max_iso = conf.autoiso_max_iso_hi_real;
        break;
    case 0: // ISO AUTO
        //max_iso = conf.autoiso_max_iso_auto*10;
        max_iso = conf.autoiso_max_iso_auto_real;
        break;
    default:
        return;
    }

    // TODO also long shutter ?
    if (camera_info.state.mode_shooting==MODE_M || camera_info.state.mode_shooting==MODE_TV || camera_info.state.mode_shooting==MODE_STITCH)
        return; //Only operate outside of M and Tv

    int ev_overexp = 0;
    if (conf.overexp_ev_enum)
    {
        // No shoot_histogram exist here because no future shot exist yet :)
        int total = live_histogram_read_y(live_histogram_proc);

        // step 32 is 1/3ev for tv96
        if (live_histogram_get_range(total,255-conf.autoiso2_over,255) >= conf.overexp_threshold)
            ev_overexp = conf.overexp_ev_enum << 5; 
    }

    float current_shutter = shooting_get_shutter_speed_from_tv96(shooting_get_tv96());

    short current_iso = shooting_get_iso_real();

    short min_shutter = shutter1_values[conf.autoiso_shutter_enum];
    if (min_shutter == 0)
    {
        short IS_factor = (shooting_get_is_mode()<=1)?conf.autoiso_is_factor:1;
        min_shutter = get_focal_length(lens_get_zoom_point())*conf.autoiso_user_factor / (IS_factor*1000);
        //min_shutter is NOT 1/Xs but optimized for the calculation.
        if (shutter2_values[conf.autoiso2_shutter_enum])
            shooting_calc_autoiso_coef( min_shutter );
    }

    short target_iso = current_iso * min_shutter * current_shutter;
    short min_iso = conf.autoiso_min_iso_real;

    if (target_iso > max_iso)
    {
        ev_overexp=0;

        // AutoISO2 if
        // 	it is turned on (C2!=0.0)
        //	and it has valid iso2/shutter2 ( C2<0)
        //       and non-IsoHI mode
        if ( !iso_mode && conf.autoiso2_coef < 0.0 )
        {
            target_iso = (max_iso - min_shutter*conf.autoiso2_coef) / ( 1.0 - conf.autoiso2_coef  / (current_shutter * current_iso) );
            if ( target_iso > conf.autoiso2_max_iso_auto_real )
                target_iso = conf.autoiso2_max_iso_auto_real;
        }
        else
        {
            target_iso = max_iso;
        }
    }
    else if (target_iso < min_iso)
    {
        target_iso = min_iso;
    }

    float target_shutter = current_shutter *  current_iso / target_iso;

	if (target_shutter > 0)
        shooting_set_tv96_direct(shooting_get_tv96_from_shutter_speed(target_shutter) + ev_overexp, SET_NOW);

    shooting_set_iso_real(target_iso, SET_NOW);
}
示例#2
0
文件: main.c 项目: barryk/CHDK-SD1200
int get_effective_focal_length(int zp) {
    return (CF_EFL*get_focal_length(zp))/10000;
}
示例#3
0
文件: main.c 项目: boyska/chdkripto
int get_zoom_x(int zp) {
    return get_focal_length(zp)*10/focus_len_table[0];
}
示例#4
0
文件: main.c 项目: boyska/chdkripto
int get_effective_focal_length(int zp) {
    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV;
}
示例#5
0
文件: main.c 项目: arne182/chdk-eyefi
int get_zoom_x(int zp) {
	return get_focal_length(zp)*10/fl_tbl[0].fl;
}
示例#6
0
//-------------------------------------------------------------------
static void gui_osd_draw_values(int is_osd_edit, int is_zebra)
{
    if (is_osd_edit || (camera_info.state.mode_rec_or_review && conf.show_values))
    {
        // showtype
        //  1   - show all values
        //  2   - show DOF values only (for zebra & MF)
        int showtype = 0;
        if (!is_zebra &&
            ((conf.show_values==SHOW_MISC_ALWAYS && camera_info.state.mode_photo) ||
             ((camera_info.state.mode_video || is_video_recording()) && conf.show_values_in_video) ||
             ((camera_info.state.is_shutter_half_press || (recreview_hold==1)) && (conf.show_values==SHOW_MISC_SHOOT))))
            showtype = 1;
        else if (is_zebra || (shooting_get_common_focus_mode() && camera_info.state.mode_photo && conf.show_values && !((conf.show_dof==DOF_SHOW_IN_DOF) || (conf.show_dof==DOF_SHOW_IN_DOF_EX))))
            showtype = 2;

        if (conf.values_show_real_iso || conf.values_show_market_iso || conf.values_show_ev_seted || 
            conf.values_show_ev_measured || conf.values_show_bv_measured || conf.values_show_bv_seted || 
            conf.values_show_overexposure || conf.values_show_canon_overexposure || conf.values_show_luminance)
            gui_osd_calc_expo_param();

        m = 0;

        short f_ex = (conf.show_dof==DOF_SHOW_IN_MISC_EX);

        if (((conf.show_dof==DOF_SHOW_IN_MISC) || f_ex) && showtype && !is_osd_edit)
        {
          if (conf.dof_subj_dist_in_misc)
              gui_print_osd_dof_string_dist("SD :", dof_values.subject_distance, f_ex && (dof_values.distance_valid || shooting_get_focus_mode()), 0);
          if (conf.dof_near_limit_in_misc)
              gui_print_osd_dof_string_dist("NL :", dof_values.near_limit, f_ex && dof_values.distance_valid, 0);
          if (conf.dof_far_limit_in_misc)
              gui_print_osd_dof_string_dist("FL :", dof_values.far_limit, f_ex && dof_values.distance_valid, 0);
          if (conf.dof_depth_in_misc)
              gui_print_osd_dof_string_dist("DOF:", dof_values.depth_of_field, f_ex && dof_values.distance_valid, 0);
          if (conf.dof_hyperfocal_in_misc)
              gui_print_osd_dof_string_dist("HYP:", dof_values.hyperfocal_distance, f_ex && dof_values.hyperfocal_valid, 1);
        }

        if ((showtype == 1) || is_osd_edit)
        {
            if (conf.values_show_zoom || is_osd_edit)
            {
                int fl, zp=shooting_get_zoom(), fl1=get_focal_length(zp);     
                switch (conf.zoom_value)
                {
                 case ZOOM_SHOW_FL:
                     sprintf(osd_buf, "Z:%d.%dmm%8s", fl1/1000, fl1%1000/100, "");
                     break;
                 case ZOOM_SHOW_EFL:
                     fl=get_effective_focal_length(zp);
                     // scale by users adapter lens eg. Canon Wide .42 or Canon Tele 1.75
                     fl = fl * conf.zoom_scale / 100;
                     sprintf(osd_buf, "Z:%3dmm%8s", fl/1000, "");
                     break;
                 case ZOOM_SHOW_X:
                 default:
                     fl=get_zoom_x(zp);
                     sprintf(osd_buf, "Z:%d/%d.%dx%8s", zp, fl/10, fl%10, "");
                     break;
                }
                gui_print_osd_misc_string();
            }

            if (conf.values_show_real_aperture || is_osd_edit)
                 gui_print_osd_misc_string_float("Av :%d.%02d ", 100, shooting_get_real_aperture()/10);

            int iso_mode = shooting_get_iso_mode();

            if ((iso_mode <= 0) || !(conf.values_show_iso_only_in_autoiso_mode))
            {
                if (conf.values_show_real_iso)      gui_print_osd_misc_string_int("I-R:", expo.iso);
                if (conf.values_show_market_iso)    gui_print_osd_misc_string_int("I-M:", expo.iso_market);
            }
            if (conf.values_show_bv_measured)           gui_print_osd_misc_string_canon_values("Bvm:", expo.bv96_measured	);
            if (conf.values_show_bv_seted)              gui_print_osd_misc_string_canon_values("Bvs:", expo.bv96_seted	);
            if (conf.values_show_ev_measured)           gui_print_osd_misc_string_canon_values("Evm:", expo.ev96_measured);
            if (conf.values_show_ev_seted)              gui_print_osd_misc_string_canon_values("Evs:", expo.ev96_seted	);
            if (conf.values_show_overexposure)          gui_print_osd_misc_string_canon_values("dE :", expo.dev96);
            if (conf.values_show_canon_overexposure)    gui_print_osd_misc_string_canon_values("dEc:", expo.dev96_canon);
            if (conf.values_show_luminance)             gui_print_osd_misc_string_float("B  :%d.%02d", 100, expo.b);
        }
    }
}