Esempio n. 1
0
//-------------------------------------------------------------------
static void gui_osd_calc_expo_param()
{
    expo.av96=shooting_get_av96();
    expo.tv96=shooting_get_tv96();
    expo.sv96=shooting_get_sv96_real();
    expo.iso=shooting_get_iso_real();
    //expo.sv96_market=shooting_get_sv96_market();
    expo.iso_market=shooting_get_iso_market();
    expo.bv96_measured=shooting_get_bv96();
    expo.ev96_seted=expo.tv96+expo.av96; //Tv96+Av96
    expo.ev96_measured=expo.bv96_measured+expo.sv96;//Bv96+Sv96
    expo.dev96=expo.ev96_measured-expo.ev96_seted;// Ev96_external-Ev96_internal
    expo.bv96_seted=expo.ev96_seted-expo.sv96;
    expo.dev96_canon=shooting_get_canon_overexposure_value();
    expo.b=shooting_get_luminance();
}
Esempio n. 2
0
int  apex2us(int apex_tv){
#if CAM_EXT_TV_RANGE
/*
 Extended Tv, by barberofcivil, http://chdk.setepontos.com/index.php/topic,4392.0.html
 Explanation by reyalP:
 In every port, the original shutter overrides (as opposed to super long exposure) worked by
 setting the propcase values at some point after auto-exposure has happened (except in manual
 modes, where the manual control propcases may be used instead). The Canon code previously took
 these values unchanged for short exposures. In newer cameras, like on the SX10 / SD980, the value
 is changed, apparently some time after it has been retrieved from the propcase. We know this is
 the case, because the propcase value itself doesn't get clamped to the allowed range (if it did,
 barberofcivil's code wouldn't work).
*/
	short tv;
	tv = shooting_get_tv96();
	if (tv<-576 || tv!=apex_tv) return 1000000.0*pow(2.0, -tv/96.0);
	else return _apex2us(apex_tv);
#else
	return 0;
#endif
}
Esempio n. 3
0
void gui_osd_draw_state(int is_osd_edit)
{
    n=0;

    if ((conf.show_state && camera_info.state.mode_rec_or_review) || is_osd_edit)
    {
        long t; 

        ///////////////////////////
        //sprintf(osd_buf,"%s",get_debug());
        //draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+6*FONT_HEIGHT, osd_buf, user_color(conf.osd_color));
        ////////////////////////////  

        if (is_tv_override_enabled || is_osd_edit)
        {
            if(camera_info.state.is_shutter_half_press) 
            { 
                t=(int)(shooting_get_shutter_speed_from_tv96(shooting_get_tv96())*100000);	
                gui_print_osd_state_string_float("TV:%d.%05d", 100000, t);
            }
            else 
            {
                if (conf.tv_enum_type==TV_OVERRIDE_EV_STEP)
                    gui_print_osd_state_string_chr("TV:",gui_tv_override_value_enum(0,0)); 
                else if (conf.tv_enum_type==TV_OVERRIDE_SHORT_EXP)
                    gui_print_osd_state_string_float("TV:%d.%05d", 100000, conf.tv_override_short_exp);
                else
                    gui_print_osd_state_string_chr("TV:",gui_hhmss_enum(0,(int)(&conf.tv_override_long_exp))); 
            }
        }
        if (is_av_override_enabled || is_osd_edit)  
            gui_print_osd_state_string_float("AV:%d.%02d", 100, shooting_get_aperture_from_av96(shooting_get_av96_override_value())/10);
        if (camera_info.cam_has_nd_filter)
            if ((conf.nd_filter_state && !(conf.override_disable==1))|| is_osd_edit) 
                gui_print_osd_state_string_chr("NDFILTER:", ((conf.nd_filter_state==1)?"IN":"OUT"));
        if ((conf.autoiso_enable && shooting_get_iso_mode()<=0 && !(camera_info.state.mode_shooting==MODE_M || camera_info.state.mode_shooting==MODE_TV) && shooting_get_flash_mode() && (autoiso_and_bracketing_overrides_are_enabled)) || is_osd_edit)  
            gui_print_osd_state_string_chr("AUTOISO:", ((conf.autoiso_enable==1)?"ON":"OFF"));
        if ((is_sd_override_enabled && shooting_can_focus()) || (camera_info.state.gui_mode_alt && shooting_get_common_focus_mode()) || is_osd_edit)
        {
            gui_print_osd_state_string_chr("SD:",gui_subj_dist_override_value_enum(0,0));
            if (camera_info.state.gui_mode_alt)
            {
                if (conf.subj_dist_override_koef == SD_OVERRIDE_ON)
                {
                    gui_print_osd_state_string_chr("Adj:",menu_increment_factor_string());
                }
                else
                    gui_print_osd_state_string_chr("Adj:",gui_subj_dist_override_koef_enum(0,0));
            }
        }
        if (is_iso_override_enabled || is_osd_edit)
            gui_print_osd_state_string_int("ISO:", shooting_iso_real_to_market(shooting_get_iso_override_value())); // get_iso_override returns "real" units, clamped within camera limits
        if (is_osd_edit || (shooting_get_drive_mode() && m!=MODE_STITCH && m!=MODE_BEST_IMAGE))
        {
          if (is_tv_bracketing_enabled || is_av_bracketing_enabled || is_iso_bracketing_enabled || is_sd_bracketing_enabled)
            gui_print_osd_state_string_chr("BRACKET:", shooting_get_bracket_type());
          if (is_tv_bracketing_enabled)
            gui_print_osd_state_string_chr("TV:", shooting_get_tv_bracket_value());
          else if (is_av_bracketing_enabled)
            gui_print_osd_state_string_chr("AV:", shooting_get_av_bracket_value());
          else if (is_iso_bracketing_enabled)
            gui_print_osd_state_string_int("ISO:", conf.iso_bracket_value);
          else if (is_sd_bracketing_enabled)
            gui_print_osd_state_string_int("SD:", conf.subj_dist_bracket_value);
        }
#ifdef OPT_CURVES
        if (conf.curve_enable || is_osd_edit) {
            if (conf.curve_enable==1) gui_print_osd_state_string_chr("CURVES:", "CSTM");
            else if (conf.curve_enable==4) gui_print_osd_state_string_chr("CURVES:", "AUTO");
            else if (conf.curve_enable==3) gui_print_osd_state_string_chr("CURVES:", "+2EV");
            else if (conf.curve_enable==2) gui_print_osd_state_string_chr("CURVES:", "+1EV");
        }
#endif
        if (conf.override_disable == 1) gui_print_osd_state_string_chr("NO ", "OVERRIDES");
        if (conf.flash_manual_override) gui_print_osd_state_string_chr("Flash:M ", gui_flash_power_modes_enum(0,0));
        if (conf.flash_enable_exp_comp) gui_print_osd_state_string_chr("Flash:A ", gui_flash_exp_comp_modes_enum(0,0));
        // edgeoverlay state
        if (conf.edge_overlay_enable || is_osd_edit) {
            if (camera_info.state.edge_state_draw==0) gui_print_osd_state_string_chr("EDGE:", "LIVE");
            else if (camera_info.state.edge_state_draw==1) gui_print_osd_state_string_chr("EDGE:", ((conf.edge_overlay_pano==0)?"FROZEN":"PANO"));
        }
#ifdef CAM_QUALITY_OVERRIDE
        // displaying the overriding picture quality if active
        if (!(conf.fast_image_quality==3) || is_osd_edit) {
            if (conf.fast_image_quality==0) gui_print_osd_state_string_chr("QUALI:", "super");
            else if (conf.fast_image_quality==1) gui_print_osd_state_string_chr("QUALI:", "fine");
            else if (conf.fast_image_quality==2) gui_print_osd_state_string_chr("QUALI:", "normal");
        }
#endif

/*
 draw_string(conf.mode_state_pos.x, conf.mode_state_pos.y+n, get_debug(), user_color(conf.osd_color));
        n+=FONT_HEIGHT;*/
    }
}
Esempio n. 4
0
static int luaCB_get_tv96( lua_State* L )
{
    lua_pushnumber( L, shooting_get_tv96() );
    return 1;
}
Esempio n. 5
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);
}