CHDK_DE Vorschauversion  Trunk Rev. 5573
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
shooting.c-Dateireferenz
#include "platform.h"
#include "keyboard.h"
#include "math.h"
#include "stdlib.h"
#include "conf.h"
#include "histogram.h"
#include "usb_remote.h"
#include "autoiso.h"
#include "levent.h"
#include "script_api.h"
+ Include-Abhängigkeitsdiagramm für shooting.c:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  PHOTO_PARAM
 

Makrodefinitionen

#define PHOTO_PARAM_TV_NONE   32767
 
#define SV96_MARKET_OFFSET   69
 
#define ISO_MARKET_TO_REAL_MULT   9955
 
#define ISO_MARKET_TO_REAL_SHIFT   14
 
#define ISO_MARKET_TO_REAL_ROUND   8192
 
#define ISO_REAL_TO_MARKET_MULT   3371
 
#define ISO_REAL_TO_MARKET_SHIFT   11
 
#define ISO_REAL_TO_MARKET_ROUND   1024
 
#define ISO_MARKET_TO_REAL(x)   (((int)x * ISO_MARKET_TO_REAL_MULT + ISO_MARKET_TO_REAL_ROUND) >> ISO_MARKET_TO_REAL_SHIFT)
 
#define ISO_REAL_TO_MARKET(x)   (((int)x * ISO_REAL_TO_MARKET_MULT + ISO_REAL_TO_MARKET_ROUND) >> ISO_REAL_TO_MARKET_SHIFT)
 
#define tv_override_zero_shift   18
 
#define AV96_MIN   (aperture_sizes_table[0].prop_id)
 
#define AV96_MAX   (aperture_sizes_table[AS_SIZE-1].prop_id)
 

Funktionen

int rec_mode_active (void)
 
void shooting_update_state (void)
 
int shooting_get_prop (int id)
 
static int shooting_get_prop_int (int id)
 
void shooting_set_prop (int id, int v)
 
short shooting_get_is_mode ()
 
short shooting_get_bv96 ()
 
short shooting_get_canon_overexposure_value ()
 
short shooting_get_flash_mode ()
 
short shooting_get_focus_mode ()
 
short shooting_get_ev_correction1 ()
 
short shooting_get_ev_correction2 ()
 
short shooting_get_resolution ()
 
short shooting_get_display_mode ()
 
int shooting_get_exif_subject_dist ()
 
int shooting_is_flash ()
 
int shooting_in_progress ()
 
int shooting_get_canon_image_format ()
 
int shooting_set_canon_image_format (int fmt)
 
int shooting_get_imager_active ()
 
int shooting_get_analog_video_standard (void)
 
int shooting_get_digital_zoom_state (void)
 
short shooting_get_real_focus_mode ()
 
short shooting_get_focus_state ()
 
short shooting_get_focus_ok ()
 
short shooting_get_drive_mode ()
 
int shooting_get_zoom ()
 
short shooting_get_canon_iso_mode ()
 
short shooting_get_sv96_market ()
 
short shooting_get_sv96_real ()
 
short shooting_get_sv96_delta ()
 
short shooting_get_sv96_from_iso (short iso)
 
short shooting_get_iso_from_sv96 (short sv96)
 
short shooting_iso_market_to_real (short isom)
 
short shooting_iso_real_to_market (short isor)
 
short shooting_sv96_market_to_real (short sv96)
 
short shooting_sv96_real_to_market (short sv96)
 
short shooting_get_iso_override_value ()
 
int shooting_get_iso_mode ()
 
short shooting_get_iso_real ()
 
short shooting_get_iso_market ()
 
static void set_iso_mode (int i)
 
void shooting_set_iso_mode (int v)
 
void shooting_set_sv96 (short sv96, short is_now)
 
void shooting_set_iso_real (short iso, short is_now)
 
static void iso_init ()
 
short shooting_get_tv96 ()
 
short shooting_get_tv96_from_shutter_speed (float t)
 
float shooting_get_shutter_speed_from_tv96 (short tv96)
 
static int shooting_get_tv96_override_value ()
 
static int find_nearest_shutter_speed_entry (short tv96)
 
static short find_canon_shutter_speed (short tv96)
 
void shooting_set_tv96_direct (short tv96, short is_now)
 
void shooting_set_tv96 (short tv96, short is_now)
 
short shooting_get_user_tv96 ()
 
int shooting_get_user_tv_id ()
 
void shooting_set_user_tv_by_id (int v)
 
void shooting_set_user_tv_by_id_rel (int v)
 
void shooting_set_user_tv96 (short tv96)
 
short shooting_get_av96 ()
 
short shooting_get_aperture_sizes_table_size ()
 
int shooting_get_aperture_from_av96 (short av96)
 
short shooting_get_av96_from_aperture (int aperture)
 
short shooting_get_av96_override_value ()
 
int shooting_get_real_aperture ()
 
static int shooting_get_min_real_aperture ()
 
void shooting_set_av96_direct (short av96, short is_now)
 
void shooting_set_av96 (short av96, short is_now)
 
short shooting_get_user_av96 ()
 
int shooting_get_user_av_id ()
 
void shooting_set_user_av_by_id (int v)
 
void shooting_set_user_av_by_id_rel (int v)
 
void shooting_set_user_av96 (short av96)
 
void shooting_set_nd_filter_state (short v, short is_now)
 
short shooting_get_min_av96 ()
 
short shooting_get_max_av96 ()
 
void shooting_init ()
 
long get_file_counter ()
 
long get_exposure_counter ()
 
void get_target_dir_name (char *dir)
 
int shooting_get_luminance ()
 
int shooting_get_subject_distance_override_value ()
 
int shooting_mode_canon2chdk (int canonmode)
 
int shooting_mode_chdk2canon (int hackmode)
 
int sd_over_modes ()
 
int shooting_get_lens_to_focal_plane_width ()
 
int shooting_get_hyperfocal_distance_1e3_f (int av, int fl)
 
int shooting_get_near_limit_f (int s, int av, int fl)
 
int shooting_get_far_limit_f (int s, int av, int fl)
 
short shooting_is_infinity_distance ()
 
int shooting_get_canon_subject_distance ()
 
int shooting_get_subject_distance_ ()
 
void shooting_update_dof_values ()
 
int shooting_get_subject_distance ()
 
int shooting_get_hyperfocal_distance ()
 
short shooting_can_focus ()
 
short shooting_get_common_focus_mode ()
 
int shooting_is_flash_ready ()
 
void shooting_set_zoom (int v)
 
void shooting_set_zoom_rel (int v)
 
void shooting_set_zoom_speed (int v)
 
void set_focus_bypass (int m)
 
void shooting_set_focus (int v, short is_now)
 
void shooting_video_bitrate_change (int v)
 
void unlock_optical_zoom (void)
 
int shooting_set_mode_canon (int canonmode)
 
int shooting_set_mode_chdk (int mode)
 
static void shooting_tv_bracketing (int when)
 
static void shooting_av_bracketing (int when)
 
static void shooting_iso_bracketing (int when)
 
static void shooting_subject_distance_bracketing (int when)
 
void bracketing_reset ()
 
void bracketing_step (int when)
 
void shooting_bracketing (void)
 
int captseq_hack_override_active ()
 
void set_movie_status (int status)
 
int get_movie_status ()
 
int is_video_recording ()
 
int mode_is_video (int m)
 
int __attribute__ ((weak))
 
int mode_get (void)
 
static void shooting_set_flash_override ()
 
void shooting_expo_param_override_thumb (void)
 
void shooting_expo_iso_override_thumb (void)
 
void shooting_set_playrec_mode (int mode)
 

Variablen

volatile long focus_busy
 
long playrec_mode
 
const ShutterSpeed shutter_speeds_table []
 
const unsigned int SS_SIZE
 
const ApertureSize aperture_sizes_table []
 pt=require'extras/proptools' Mehr ...
 
const unsigned int AS_SIZE
 
const CapturemodeMap modemap []
 
const unsigned int MODESCNT
 
static short * min_av96_zoom_point_tbl = NULL
 
static PHOTO_PARAM photo_param_put_off
 
static int iso_override_mode_save = 0
 
static const double inv_log_2 = 1.44269504088906
 
const ISOTable iso_table []
 
const unsigned int ISO_SIZE
 
static short canon_iso_base =0
 
static short canon_sv96_base =0
 
const unsigned int param_file_counter
 
static const double K = 12.5
 
static int focus_interlock_bypass = 0
 
EXPO_BRACKETING_VALUES bracketing
 
static int bracket_steps [4][2]
 
static int bracket_delta [4][2]
 
int movie_status
 

Makro-Dokumentation

#define AV96_MAX   (aperture_sizes_table[AS_SIZE-1].prop_id)

Definiert in Zeile 777 der Datei shooting.c.

#define AV96_MIN   (aperture_sizes_table[0].prop_id)

Definiert in Zeile 776 der Datei shooting.c.

#define ISO_MARKET_TO_REAL (   x)    (((int)x * ISO_MARKET_TO_REAL_MULT + ISO_MARKET_TO_REAL_ROUND) >> ISO_MARKET_TO_REAL_SHIFT)

Definiert in Zeile 406 der Datei shooting.c.

#define ISO_MARKET_TO_REAL_MULT   9955

Definiert in Zeile 398 der Datei shooting.c.

#define ISO_MARKET_TO_REAL_ROUND   8192

Definiert in Zeile 400 der Datei shooting.c.

#define ISO_MARKET_TO_REAL_SHIFT   14

Definiert in Zeile 399 der Datei shooting.c.

#define ISO_REAL_TO_MARKET (   x)    (((int)x * ISO_REAL_TO_MARKET_MULT + ISO_REAL_TO_MARKET_ROUND) >> ISO_REAL_TO_MARKET_SHIFT)

Definiert in Zeile 407 der Datei shooting.c.

#define ISO_REAL_TO_MARKET_MULT   3371

Definiert in Zeile 401 der Datei shooting.c.

#define ISO_REAL_TO_MARKET_ROUND   1024

Definiert in Zeile 403 der Datei shooting.c.

#define ISO_REAL_TO_MARKET_SHIFT   11

Definiert in Zeile 402 der Datei shooting.c.

#define PHOTO_PARAM_TV_NONE   32767

Definiert in Zeile 39 der Datei shooting.c.

#define SV96_MARKET_OFFSET   69

Definiert in Zeile 393 der Datei shooting.c.

#define tv_override_zero_shift   18

Definiert in Zeile 632 der Datei shooting.c.

Dokumentation der Funktionen

int __attribute__ ( (weak)  )

Definiert in Zeile 1755 der Datei shooting.c.

1756 {
1757  return (playrec_mode==2 || playrec_mode==4 || playrec_mode==5);
1758 }
void bracketing_reset ( )

Definiert in Zeile 1603 der Datei shooting.c.

void bracketing_step ( int  when)

Definiert in Zeile 1610 der Datei shooting.c.

int captseq_hack_override_active ( )

Definiert in Zeile 1638 der Datei shooting.c.

1639 {
1642  return 1;
1643 #if CAM_HAS_IRIS_DIAPHRAGM
1645  return 1;
1646 #endif
1647  }
1648  if(conf.override_disable==1)
1649  return 0;
1651  return 1;
1653  return 1;
1654 #if CAM_HAS_IRIS_DIAPHRAGM
1656  return 1;
1657 #endif
1658  return 0;
1659 }
static short find_canon_shutter_speed ( short  tv96)
static

Definiert in Zeile 671 der Datei shooting.c.

static int find_nearest_shutter_speed_entry ( short  tv96)
static

Definiert in Zeile 650 der Datei shooting.c.

651 {
652  if (tv96 <= shutter_speeds_table[0].prop_id)
653  return 0;
654 
655  int i;
656  for (i=0; i<SS_SIZE-1; i++)
657  {
658  if ((tv96 > shutter_speeds_table[i].prop_id) && (tv96 <= shutter_speeds_table[i+1].prop_id))
659  {
660  if ((tv96 - shutter_speeds_table[i].prop_id) < (shutter_speeds_table[i+1].prop_id - tv96))
661  return i;
662  else
663  return i+1;
664  }
665  }
666 
667  return SS_SIZE-1;
668 }
long get_exposure_counter ( )

Definiert in Zeile 1052 der Datei shooting.c.

1053 {
1054  long v = 0;
1056  v = ((v>>4)&0x3FFF);
1057  return v;
1058 }
long get_file_counter ( )

Definiert in Zeile 1045 der Datei shooting.c.

1046 {
1047  long v = 0;
1049  return v;
1050 }
int get_movie_status ( )

Definiert in Zeile 1696 der Datei shooting.c.

1697 {
1698 #ifndef CAM_SIMPLE_MOVIE_STATUS
1699  return movie_status;
1700 #else
1701  // firmware movie_status interpreted as: zero - not recording, nonzero - recording
1702  return simple_movie_status?VIDEO_RECORD_IN_PROGRESS:VIDEO_RECORD_STOPPED;
1703 #endif
1704 }
void get_target_dir_name ( char *  dir)

Definiert in Zeile 1062 der Datei shooting.c.

1062  {
1063  extern long get_target_dir_num();
1064  sprintf(dir,"A/DCIM/%03dCANON",get_target_dir_num());
1065 }
int is_video_recording ( )

Definiert in Zeile 1707 der Datei shooting.c.

1708 {
1709 #ifndef CAM_SIMPLE_MOVIE_STATUS
1710 #if defined(CAM_HAS_MOVIE_DIGEST_MODE)
1711  // If camera has movie digest mode then movie_status values are different than previous models
1712  // 'movie_status' values
1713  // 0 - after startup
1714  // 1 - movie recording stopped
1715  // 4 - movie recording in progress, or in 'movie digest' scene mode
1716  // 5 - movie recording stopping
1717  // 6 - in video mode, not recording
1719 #else
1720  // 'movie_status' values
1721  // 0 - after startup
1722  // 1 - movie recording stopped
1723  // 4 - movie recording in progress
1724  // 5 - movie recording stopping
1725  return (movie_status > 1);
1726 #endif
1727 #else // CAM_SIMPLE_MOVIE_STATUS
1728  return (simple_movie_status!=0);
1729 #endif
1730 }
static void iso_init ( )
static

Definiert in Zeile 587 der Datei shooting.c.

588 {
589  // Get the camera ISO base value, store in global variable 'canon_iso_base'
590  if (iso_table[1-iso_table[0].id].prop_id == 50)
591  canon_iso_base = 50;
592  else
594 
595  // Get the SV96 value corresponding to the base Canon ISO for the camera
596  // Store in global variable 'canon_sv96_base'
598 }
int mode_get ( void  )

Definiert in Zeile 1760 der Datei shooting.c.

1761 {
1762  int mode, t=0xFF;
1763 
1764  mode = (rec_mode_active())?MODE_REC:MODE_PLAY;
1765 
1766 #ifdef CAM_SWIVEL_SCREEN
1767  extern int screen_opened(void); // 0 not open, non-zero open
1768  extern int screen_rotated(void); // 0 not rotated, non-zero rotated
1769 
1770  mode |= (screen_opened())?MODE_SCREEN_OPENED:0;
1771  mode |= (screen_rotated())?MODE_SCREEN_ROTATED:0;
1772 #endif
1773 
1774 #ifdef CAM_SUPPORT_BITMAP_RES_CHANGE
1775  extern void update_screen_dimensions();
1777 #endif
1778 
1780 #ifdef CAM_MASK_VID_REC_ACTIVE
1782 #else
1783  mode |= shooting_mode_canon2chdk(t);
1784 #endif
1785 
1786  // Set camera state variables from mode info
1790  camera_info.state.mode_rec = ((mode & MODE_MASK) == MODE_REC);
1792  camera_info.state.mode_play = ((mode & MODE_MASK) == MODE_PLAY);
1794 
1795  return (mode);
1796 }
int mode_is_video ( int  m)

Definiert in Zeile 1733 der Datei shooting.c.

1734 {
1735  m = m & MODE_SHOOTING_MASK;
1736  return (m==MODE_VIDEO_STD ||
1737  m==MODE_VIDEO_SPEED ||
1738  m==MODE_VIDEO_COMPACT ||
1745  m==MODE_VIDEO_M ||
1749  // not clear if this should be considered a video mode ?
1750  // m==MODE_VIDEO_MOVIE_DIGEST
1751  );
1752 }
int rec_mode_active ( void  )

Definiert in Zeile 221 der Datei main.c.

221  {
222 // return ((physw_status[0]&0x03)==0x01) ? 0 : 1;
223  return (playrec_mode==1); //(0 in play, 1 in record, 2 in record review)
224 }
int sd_over_modes ( void  )

Definiert in Zeile 1118 der Datei shooting.c.

1119 { return ( 0
1120 #ifdef CAM_SD_OVER_IN_AF
1121  + 1
1122 #endif
1123 #ifdef CAM_SD_OVER_IN_AFL
1124  + 2
1125 #endif
1126 #ifdef CAM_SD_OVER_IN_MF
1127  + 4
1128 #endif
1129 ); }
void set_focus_bypass ( int  m)

Definiert in Zeile 1389 der Datei shooting.c.

1390 {
1392 }
static void set_iso_mode ( int  i)
static

Definiert in Zeile 494 der Datei shooting.c.

495 {
496  short vv = iso_table[i].prop_id;
497  set_property_case(PROPCASE_ISO_MODE, &vv, sizeof(vv));
498 }
void set_movie_status ( int  status)

Definiert in Zeile 1667 der Datei shooting.c.

1668 {
1669 #ifndef CAM_SIMPLE_MOVIE_STATUS
1670  switch(status)
1671  {
1672  case 1:
1674  {
1676  }
1677  break;
1678  case 2:
1680  {
1682  }
1683  break;
1684  case 3:
1686  {
1688  }
1689  break;
1690  }
1691 #else // CAM_SIMPLE_MOVIE_STATUS
1692  // no known way to control the recording process
1693 #endif
1694 }
static void shooting_av_bracketing ( int  when)
static

Definiert in Zeile 1527 der Datei shooting.c.

1528 {
1529  // first shot? (actually this is called just after the first shot has been taken)
1530  if (bracketing.shoot_counter == 0)
1531  {
1534  else
1537  }
1538 
1539  // Adjust delta AV value for shot based on shot number
1541  // Calculate new AV (note, need to subtract delta because higher values are smaller apertures / darker images)
1543 
1544  // Inc for next shot
1546 
1547  // Apply value for next shot to be taken
1548  if (value != bracketing.av96)
1549  {
1550  shooting_set_av96_direct(value, when);
1551 #ifdef CAM_AV_OVERRIDE_IRIS_FIX
1552  extern int MoveIrisWithAv(short*);
1553  MoveIrisWithAv(&value);
1554 #endif
1555  }
1556 }
void shooting_bracketing ( void  )

Definiert in Zeile 1618 der Datei shooting.c.

short shooting_can_focus ( )

Definiert in Zeile 1291 der Datei shooting.c.

1292 {
1293  if(camera_info.state.mode_play) return 0 ; // don't focus in playback mode
1294 
1295  if(focus_interlock_bypass) return 1; // checks disabled, allow
1296 
1297  if( camera_info.state.mode_video == 1) return 1; // FIXME : default to MF enabled in video mode for now
1298 
1299 #ifdef CAM_SD_OVER_IN_AFL
1300  if (shooting_get_prop(PROPCASE_AF_LOCK)==1 ) return 1; // allow focus if AFL enabled and camera can focus that way?
1301 #endif
1302 #ifdef CAM_SD_OVER_IN_MF
1303  if (shooting_get_prop(PROPCASE_FOCUS_MODE)==1 ) return 1; // allow focus if MF enabled and camera can focus that way?
1304 #endif
1305 
1306 #ifdef CAM_SD_OVER_IN_AF
1307 #ifdef PROPCASE_CONTINUOUS_AF
1308  if (shooting_get_prop(PROPCASE_CONTINUOUS_AF)) return 0; // don't focus in continuous AF mode,
1309 #endif
1310 #ifdef PROPCASE_SERVO_AF
1311  if (shooting_get_prop(PROPCASE_SERVO_AF)) return 0; // don't focus in servo AF mode
1312 #endif
1313  if ( (shooting_get_prop(PROPCASE_AF_LOCK)==0) // allow focus when in AF mode (i.e AFL or MF not enabled)?
1314  && (shooting_get_prop(PROPCASE_FOCUS_MODE)==0 )) return 1;
1315 #endif
1316  return 0;
1317 }
void shooting_expo_iso_override_thumb ( void  )

Definiert in Zeile 1958 der Datei shooting.c.

1959 {
1961  {
1963  // photo_param_put_off.sv96 is not reset here, it will be reset in next call to shooting_expo_param_override
1964  }
1965  else if (is_iso_override_enabled)
1969 
1970 #if defined(CAM_HAS_ND_FILTER) && defined(CAM_HAS_NATIVE_ND_FILTER)
1972  {
1974  //photo_param_put_off.nd_filter=0;
1975  }
1976  else if (conf.nd_filter_state && !(conf.override_disable==1))
1978 #endif
1979 
1980  // Set flash mode & override
1982 }
void shooting_expo_param_override_thumb ( void  )

Definiert in Zeile 1892 der Datei shooting.c.

1893 {
1895  {
1898  }
1899  else if (is_tv_override_enabled)
1900  {
1902  }
1903 
1905  {
1908  }
1909  else if (is_iso_override_enabled)
1913 
1915  {
1918  }
1919  else if (is_av_override_enabled)
1921 
1923  {
1926  }
1927  else if (is_sd_override_enabled)
1929 
1930 #if CAM_HAS_ND_FILTER
1932  {
1935  }
1936  else if (conf.nd_filter_state && !(conf.override_disable==1))
1938 #endif
1939 
1940 #if CAM_REAR_CURTAIN
1941  shooting_set_flash_sync_curtain(conf.flash_sync_curtain);
1942 #endif
1943 
1944  // Set flash mode & override
1946 
1947 #if CAM_QUALITY_OVERRIDE
1948  // this doesn't really need to be set in the override hook.
1949  // should only need to be set once if the users doesn't change back, but doing it here ensures it is set
1950  shooting_set_image_quality(conf.fast_image_quality);
1951 #endif
1952 
1954 }
int shooting_get_analog_video_standard ( void  )

Definiert in Zeile 233 der Datei shooting.c.

234 {
235 #ifdef PROPCASE_LANGUAGE
237  // lowest bit of language propcase
238  v = (v&1) + 1;
239  return v;
240 #else // if unknown, just pretend it's NTSC
241  return 1;
242 #endif
243 }
int shooting_get_aperture_from_av96 ( short  av96)

Definiert in Zeile 784 der Datei shooting.c.

785 {
786  if (av96)
787  return (short)((pow(2, ((double)av96)/192.0))*1000.0 + 0.5);
788  return -1;
789 }
short shooting_get_aperture_sizes_table_size ( )

Definiert in Zeile 780 der Datei shooting.c.

780 { return AS_SIZE; }
short shooting_get_av96 ( )

Definiert in Zeile 779 der Datei shooting.c.

779 { return shooting_get_prop(PROPCASE_AV); }
short shooting_get_av96_from_aperture ( int  aperture)

Definiert in Zeile 791 der Datei shooting.c.

792 {
793  return (int)((log((double)aperture/1000.0) * 192 * inv_log_2) + 0.5);
794 }
short shooting_get_av96_override_value ( )

Definiert in Zeile 797 der Datei shooting.c.

798 {
801  return (short) (AV96_MAX+32*(conf.av_override_value-AS_SIZE+1));
802 }
short shooting_get_bv96 ( )

Definiert in Zeile 125 der Datei shooting.c.

125 { return shooting_get_prop(PROPCASE_BV); }
int shooting_get_canon_image_format ( )

Definiert in Zeile 139 der Datei shooting.c.

139  {
140 #ifdef CAM_HAS_CANON_RAW
141 #ifdef PROPCASE_IMAGE_FORMAT
143  case 0:
144  return SHOOTING_CANON_FMT_RAW;
145  case 2:
147  default:
148  return SHOOTING_CANON_FMT_JPG;
149  }
150 #else // PROPCASE_IMAGE_FORMAT not defined, = propset 2 or 3
151  if(shooting_get_prop(PROPCASE_RESOLUTION) == 5) { // resolution 5 = raw, jpeg controlled by JPEG_WITH_RAW
154  }
155  return SHOOTING_CANON_FMT_RAW;
156  } else {
157  return SHOOTING_CANON_FMT_JPG;
158  }
159 #endif
160 #else // no native raw
161  return SHOOTING_CANON_FMT_JPG;
162 #endif
163 }
short shooting_get_canon_iso_mode ( )

Definiert in Zeile 382 der Datei shooting.c.

short shooting_get_canon_overexposure_value ( )

Definiert in Zeile 126 der Datei shooting.c.

int shooting_get_canon_subject_distance ( )

Definiert in Zeile 1168 der Datei shooting.c.

1169 {
1172  else
1173  return (lens_get_focus_pos_from_lens());
1174 }
short shooting_get_common_focus_mode ( )

Definiert in Zeile 1319 der Datei shooting.c.

1320 {
1321 #if !CAM_HAS_MANUAL_FOCUS
1322  return conf.subj_dist_override_koef; // SD override state 0=OFF, 1=ON, 2=Infinity if camera has no native MF mode
1323 #else
1324  return shooting_get_focus_mode(); // 0=Auto, 1=manual
1325 #endif
1326 }
int shooting_get_digital_zoom_state ( void  )

Definiert in Zeile 261 der Datei shooting.c.

262 {
263 #if CAM_PROPSET == 7 || CAM_PROPSET == 9 || CAM_PROPSET == 10 || CAM_PROPSET == 11 || CAM_PROPSET == 12 || CAM_PROPSET == 13
264  // PS7 doesn't have _STATE, combines values
266  if(x==1) {
267  return 1;
268  }
269  return 0;
270 #else
272 #endif
273 }
short shooting_get_display_mode ( )

Definiert in Zeile 132 der Datei shooting.c.

short shooting_get_drive_mode ( )

Definiert in Zeile 302 der Datei shooting.c.

303 {
304  // these cameras do not set PROPCASE_DRIVE_MODE when in custom timer mode
305  // SX 200 IS 0,1,2,3,4=Off, 2 Second, Custom, Face Detection
306 #if defined (CAM_DRIVE_MODE_FROM_TIMER_MODE)
308  // note we return this only in custom mode.
309  // Other cameras would return 3 if any timer mode is set (?) even if it doesn't do multiple exposures
310  // note that face detect does multiple exposure
311  if (m == 3)
312  return m;
313 #endif
314 
316 }
short shooting_get_ev_correction1 ( )

Definiert in Zeile 129 der Datei shooting.c.

short shooting_get_ev_correction2 ( )

Definiert in Zeile 130 der Datei shooting.c.

int shooting_get_exif_subject_dist ( )

Definiert in Zeile 134 der Datei shooting.c.

int shooting_get_far_limit_f ( int  s,
int  av,
int  fl 
)

Definiert in Zeile 1153 der Datei shooting.c.

1154 {
1155  if (shooting_is_infinity_distance()) return (-1);
1156  int h_1e3 = shooting_get_hyperfocal_distance_1e3_f(av, fl);
1157  double m = ((double)(h_1e3 - fl)+500)/1000*s;
1158  int v = ((h_1e3 - 1000*s)+500)/1000;
1159  if ((m>0) && (v>0)) return (int)((2*m/v+1)/2);
1160  else return (-1);
1161 }
short shooting_get_flash_mode ( )

Definiert in Zeile 127 der Datei shooting.c.

short shooting_get_focus_mode ( )

Definiert in Zeile 128 der Datei shooting.c.

short shooting_get_focus_ok ( )

Definiert in Zeile 297 der Datei shooting.c.

298 {
299  return ((shooting_get_focus_state()!=0) && shooting_in_progress());
300 }
short shooting_get_focus_state ( )

Definiert in Zeile 290 der Datei shooting.c.

291 {
292  if (shooting_get_focus_mode()==1) return -1;
294  return (short) m;
295 }
int shooting_get_hyperfocal_distance ( )

Definiert in Zeile 1283 der Datei shooting.c.

1284 {
1287 }
int shooting_get_hyperfocal_distance_1e3_f ( int  av,
int  fl 
)

Definiert in Zeile 1136 der Datei shooting.c.

1137 {
1138  if ((av>0) && (fl>0) && (camera_info.circle_of_confusion>0))
1139  return (int)(((((double)fl*fl)/(av*camera_info.circle_of_confusion)*1000)+fl)+0.5);
1140  else return (-1);
1141 }
int shooting_get_imager_active ( )

Definiert in Zeile 222 der Datei shooting.c.

222  {
223  extern int imager_active;
224  return imager_active;
225 }
short shooting_get_is_mode ( )

Definiert in Zeile 124 der Datei shooting.c.

short shooting_get_iso_from_sv96 ( short  sv96)

Definiert in Zeile 417 der Datei shooting.c.

418 {
419  // APEX equation --> (int)(POWER(2,(iso/96)) * 3.125) + 0.5)
420  return (short)( (double)pow(2, (((double)sv96)/96.0))*100.0/32.0 + 0.5 );
421 }
short shooting_get_iso_market ( )

Definiert in Zeile 486 der Datei shooting.c.

487 {
489  if (sv == 0)
490  return 0;
491  return shooting_get_iso_from_sv96(sv);
492 }
int shooting_get_iso_mode ( )

Definiert in Zeile 465 der Datei shooting.c.

466 {
467  short isov = shooting_get_canon_iso_mode();
468  long i;
469  for (i=0;i<ISO_SIZE;i++)
470  {
471  if (iso_table[i].prop_id == isov)
472  return iso_table[i].id;
473  }
474  return 0;
475 }
short shooting_get_iso_override_value ( )

Definiert in Zeile 443 der Datei shooting.c.

444 {
445  short iso = conf.iso_override_value; // Start with market value
446  // Apply limits if needed
447 #ifdef CAM_ISO_LIMIT_IN_HQ_BURST
448  // Limit max ISO in HQ burst mode (also done in shooting_set_iso_real; but done here so OSD display value is correct)
451 #endif
452 #ifdef CAM_MIN_ISO_OVERRIDE
453  // Limit min (non-zero) ISO
454  // Some cameras will crash if flash used and ISO set lower than this value (most easily tested in AUTO mode)
455  if ((iso > 0) && (iso < CAM_MIN_ISO_OVERRIDE)) iso = CAM_MIN_ISO_OVERRIDE;
456 #endif
457 #ifdef CAM_MAX_ISO_OVERRIDE
458  // Limit max ISO
459  // Some cameras will crash if ISO set higher than this value (dependence on flash is unclear)
461 #endif
462  return shooting_iso_market_to_real(iso); // return real value (after limits applied)
463 }
short shooting_get_iso_real ( )

Definiert in Zeile 477 der Datei shooting.c.

478 {
479  short sv = shooting_get_sv96_real();
480  if (sv == 0)
481  return 0;
482  return shooting_get_iso_from_sv96(sv);
483 }
int shooting_get_lens_to_focal_plane_width ( )

Definiert in Zeile 1131 der Datei shooting.c.

1132 {
1134 }
int shooting_get_luminance ( )

Definiert in Zeile 1073 der Datei shooting.c.

1074 {
1075  short bv = shooting_get_bv96();
1076  int b = (int)(100 * K * pow(2.0,((double)(bv-168)/96.0)));
1077  return b;
1078 }
short shooting_get_max_av96 ( )

Definiert in Zeile 1000 der Datei shooting.c.

1001 {
1002 #if CAM_HAS_IRIS_DIAPHRAGM
1003  extern short GetUsableMinAv(void);
1005  {
1006  return -1;
1007  }
1008  return GetUsableMinAv();
1009 #else
1010  return -1;
1011 #endif
1012 }
short shooting_get_min_av96 ( )

Definiert in Zeile 986 der Datei shooting.c.

987 {
988 #if CAM_HAS_IRIS_DIAPHRAGM
989  extern short GetUsableMaxAv(void);
991  {
992  return -1;
993  }
994  return GetUsableMaxAv();
995 #else
996  return -1;
997 #endif
998 }
static int shooting_get_min_real_aperture ( )
static

Definiert in Zeile 809 der Datei shooting.c.

810 {
811  short av96;
812  get_property_case(PROPCASE_MIN_AV, &av96, sizeof(av96));
813  if (av96)
814  return shooting_get_aperture_from_av96(av96);
816 }
int shooting_get_near_limit_f ( int  s,
int  av,
int  fl 
)

Definiert in Zeile 1143 der Datei shooting.c.

1144 {
1145  if (shooting_is_infinity_distance()) return (-1);
1146  int h_1e3 = shooting_get_hyperfocal_distance_1e3_f(av, fl);
1147  double m = ((double)(h_1e3 - fl)+500)/1000*s;
1148  int v = ((h_1e3 - 2*fl + 1000*s)+500)/1000;
1149  if ((m>0) && (v>0)) return (int)((2*m/v+1)/2);
1150  else return (-1);
1151 }
int shooting_get_prop ( int  id)

Definiert in Zeile 103 der Datei shooting.c.

104 {
105  short vv;
106  get_property_case(id, &vv, sizeof(vv));
107  return vv;
108 }
static int shooting_get_prop_int ( int  id)
static

Definiert in Zeile 110 der Datei shooting.c.

111 {
112  int vv;
113  get_property_case(id, &vv, sizeof(vv));
114  return vv;
115 }
int shooting_get_real_aperture ( )

Definiert in Zeile 804 der Datei shooting.c.

short shooting_get_real_focus_mode ( )

Definiert in Zeile 282 der Datei shooting.c.

283 {
284  short f = shooting_get_focus_mode();
286  if (f==0 && m!=0) f=(m==1)?4:m;
287  return f;
288 }
short shooting_get_resolution ( )

Definiert in Zeile 131 der Datei shooting.c.

float shooting_get_shutter_speed_from_tv96 ( short  tv96)

Definiert in Zeile 623 der Datei shooting.c.

624 {
625  return pow(2,((float)(-tv96))/96.0);
626 }
int shooting_get_subject_distance ( )

Definiert in Zeile 1277 der Datei shooting.c.

1278 {
1281 }
int shooting_get_subject_distance_ ( )
int shooting_get_subject_distance_override_value ( )
short shooting_get_sv96_delta ( )

Definiert in Zeile 385 der Datei shooting.c.

short shooting_get_sv96_from_iso ( short  iso)

Definiert in Zeile 409 der Datei shooting.c.

410 {
411  // Equivalent to (short)(log2(iso/3.125)*96+0.5) [APEX equation]
412  if (iso > 0)
413  return (short)( log((double)(iso)*32.0/100.0)*96.0*(inv_log_2)+0.5 );
414  return 0;
415 }
short shooting_get_sv96_market ( )

Definiert in Zeile 383 der Datei shooting.c.

short shooting_get_sv96_real ( )

Definiert in Zeile 384 der Datei shooting.c.

384 { return shooting_get_prop(PROPCASE_SV); }
short shooting_get_tv96 ( )

Definiert in Zeile 607 der Datei shooting.c.

607 { return shooting_get_prop(PROPCASE_TV); }
short shooting_get_tv96_from_shutter_speed ( float  t)

Definiert in Zeile 611 der Datei shooting.c.

612 {
613  if (t > 0)
614  {
615  t = ((96.0 * -log(t)) * inv_log_2);
616  if (t < 0)
617  return (short)(t - 0.5);
618  return (short)(t + 0.5);
619  }
620  return SHOOTING_TV96_INVALID;
621 }
static int shooting_get_tv96_override_value ( )
static

Definiert in Zeile 636 der Datei shooting.c.

637 {
638  // Calculate the tv96 value for the tv override
643  else
645 }
short shooting_get_user_av96 ( )

Definiert in Zeile 879 der Datei shooting.c.

880 {
881 #if CAM_HAS_IRIS_DIAPHRAGM
883 #else
884  return 0;
885 #endif
886 }
int shooting_get_user_av_id ( )

Definiert in Zeile 888 der Datei shooting.c.

889 {
890 #if CAM_HAS_IRIS_DIAPHRAGM
891  return aperture_sizes_table[find_nearest_aperture_entry(shooting_get_user_av96())].prop_id;
892 #else
893  return 0;
894 #endif
895 }
short shooting_get_user_tv96 ( )

Definiert in Zeile 700 der Datei shooting.c.

701 {
702 #if CAM_HAS_USER_TV_MODES
704 #else
705  return 0;
706 #endif
707 }
int shooting_get_user_tv_id ( )

Definiert in Zeile 709 der Datei shooting.c.

710 {
711 #if CAM_HAS_USER_TV_MODES
713 #else
714  return 0;
715 #endif
716 }
int shooting_get_zoom ( )

Definiert in Zeile 318 der Datei shooting.c.

319 {
320  return lens_get_zoom_point();
321 }
int shooting_in_progress ( )

Definiert in Zeile 136 der Datei shooting.c.

void shooting_init ( )

Definiert in Zeile 1021 der Datei shooting.c.

1022 {
1024  iso_init();
1025 }
int shooting_is_flash ( )

Definiert in Zeile 135 der Datei shooting.c.

int shooting_is_flash_ready ( )

Definiert in Zeile 1328 der Datei shooting.c.

1329 {
1330  int t = shooting_get_flash_mode();
1331  if ((t != 2) && (shooting_in_progress()))
1332  if (shooting_is_flash())
1333  return IsStrobeChargeCompleted();
1334  return 1;
1335 }
short shooting_is_infinity_distance ( )

Definiert in Zeile 1163 der Datei shooting.c.

1164 {
1165  return (shooting_get_lens_to_focal_plane_width() == 0)?1:0;
1166 }
static void shooting_iso_bracketing ( int  when)
static

Definiert in Zeile 1558 der Datei shooting.c.

1559 {
1560  // first shot? (actually this is called just after the first shot has been taken)
1561  if (bracketing.shoot_counter == 0)
1562  {
1565  }
1566 
1567  // Adjust delta ISO value for shot based on shot number
1569  // Calculate new ISO (higher ISO = brighter image)
1571  if (value <= 0) value = 50;
1572 
1573  // Inc for next shot
1575 
1576  // Apply value for next shot to be taken
1577  shooting_set_iso_real(value, when);
1578 }
short shooting_iso_market_to_real ( short  isom)

Definiert in Zeile 423 der Datei shooting.c.

424 {
425  return ISO_MARKET_TO_REAL(isom);
426 }
short shooting_iso_real_to_market ( short  isor)

Definiert in Zeile 428 der Datei shooting.c.

429 {
430  return ISO_REAL_TO_MARKET(isor);
431 }
int shooting_mode_canon2chdk ( int  canonmode)

Definiert in Zeile 1094 der Datei shooting.c.

1095 {
1096  int i;
1097  for (i=0; i < MODESCNT; i++)
1098  {
1099  if (modemap[i].canonmode == canonmode)
1100  return modemap[i].hackmode;
1101  }
1102  return 0;
1103 }
int shooting_mode_chdk2canon ( int  hackmode)

Definiert in Zeile 1105 der Datei shooting.c.

1106 {
1107  int i;
1108  for (i=0; i < MODESCNT; i++)
1109  {
1110  if (modemap[i].hackmode == hackmode)
1111  return modemap[i].canonmode;
1112  }
1113  return -1; // 0 is a valid mode on old cameras!
1114 }
void shooting_set_av96 ( short  av96,
short  is_now 
)

Definiert in Zeile 869 der Datei shooting.c.

870 {
871 #if CAM_HAS_IRIS_DIAPHRAGM
873  shooting_set_av96_direct(find_canon_aperture(av96), is_now);
874 #endif
875 }
void shooting_set_av96_direct ( short  av96,
short  is_now 
)

Definiert in Zeile 851 der Datei shooting.c.

852 {
853 #if CAM_HAS_IRIS_DIAPHRAGM
855  {
856  if(is_now)
857  {
858  set_property_case(PROPCASE_AV, &av96, sizeof(av96));
859 #ifdef PROPCASE_AV2
860  set_property_case(PROPCASE_AV2, &av96, sizeof(av96)); // Save override to property that will update JPEG header & Canon OSD
861 #endif
862  }
863  else
864  photo_param_put_off.av96 = av96;
865  }
866 #endif
867 }
int shooting_set_canon_image_format ( int  fmt)

Definiert in Zeile 166 der Datei shooting.c.

166  {
167 #ifdef CAM_HAS_CANON_RAW
168 #ifdef PROPCASE_IMAGE_FORMAT
169  int v;
170  switch(fmt) {
172  v = 0;
173  break;
175  v = 2;
176  break;
178  v = 1;
179  break;
180  default:
181  return 0;
182  }
184  return 1;
185 #else // PROPCASE_IMAGE_FORMAT not defined, propset 2 or 3
186  // raw enabled is in resolution, try to save when changing to raw, restore when switching to jpeg
187  static int saved_resolution = -1;
188 
189  // invalid format, bail
190  if(fmt < 1 || fmt > 3) {
191  return 0;
192  }
193  if(fmt & SHOOTING_CANON_FMT_RAW) {
195  if( res != 5) { // raw requested, if resolution not already set, set to 5 and previous
196  saved_resolution = res;
198  }
199  if(fmt & SHOOTING_CANON_FMT_JPG) {
201  } else {
203  }
204  } else { // jpeg
205  if(shooting_get_prop(PROPCASE_RESOLUTION) == 5) { // 5 = raw for cams that set with resolution
206  if(saved_resolution != -1) {
207  shooting_set_prop(PROPCASE_RESOLUTION,saved_resolution); // switching to jpeg, try to restore resolution
208  saved_resolution = -1;
209  } else {
210  shooting_set_prop(PROPCASE_RESOLUTION,0); // default to L if we don't know
211  }
212  }
213  }
214  return 1;
215 #endif
216 #else // no native raw
217  return fmt == SHOOTING_CANON_FMT_JPG; // only setting jpeg is valid
218 #endif
219 }
static void shooting_set_flash_override ( )
static

Definiert in Zeile 1860 der Datei shooting.c.

1861 {
1862  int mode, flash, power;
1863  flash = 1;
1864 
1865  // Set flash mode & override
1867  {
1869  {
1870  mode = 1; // Manual flash
1872  set_property_case(PROPCASE_FLASH_ADJUST_MODE, &mode, sizeof(mode));
1873  set_property_case(PROPCASE_FLASH_FIRE, &flash, sizeof(flash));
1874  set_property_case(PROPCASE_FLASH_MANUAL_OUTPUT, &power, sizeof(power));
1875  }
1876  else if (conf.flash_enable_exp_comp)
1877  {
1878  mode = 0; // Auto flash
1879  power = (conf.flash_exp_comp - 9) * 32;
1880  set_property_case(PROPCASE_FLASH_ADJUST_MODE, &mode, sizeof(mode));
1881  set_property_case(PROPCASE_FLASH_FIRE, &flash, sizeof(flash));
1882 #if defined(PROPCASE_FLASH_EXP_COMP)
1883  set_property_case(PROPCASE_FLASH_EXP_COMP, &power, sizeof(power));
1884 #endif
1885 #if defined(PROPCASE_EXT_FLASH_EXP_COMP)
1886  set_property_case(PROPCASE_EXT_FLASH_EXP_COMP, &power, sizeof(power));
1887 #endif
1888  }
1889  }
1890 }
void shooting_set_focus ( int  v,
short  is_now 
)

Definiert in Zeile 1394 der Datei shooting.c.

1395 {
1396  int s=v;
1398  {
1399  if (is_now && shooting_can_focus())
1400  {
1402  {
1404  }
1405  if (!conf.dof_use_exif_subj_dist && (s != INFINITY_DIST))
1407  lens_set_focus_pos(s);
1408  }
1409  else
1411  }
1412 }
void shooting_set_iso_mode ( int  v)

Definiert in Zeile 500 der Datei shooting.c.

501 {
502  int i;
503  if (v < 50) // CHDK ID
504  {
505  for (i=0; i<ISO_SIZE; i++)
506  {
507  if (iso_table[i].id == v)
508  {
509  set_iso_mode(i);
510  return;
511  }
512  }
513  }
514  else // ISO value - find nearest entry in iso_table and set iso mode to that value
515  {
516  if (v <= iso_table[0].prop_id) // In case no AUTO (0) entry
517  {
518  set_iso_mode(0);
519  return;
520  }
521  for (i=0; i<ISO_SIZE-1; i++)
522  {
523  if ((v > iso_table[i].prop_id) && (v <= iso_table[i+1].prop_id))
524  {
525  if ((v - iso_table[i].prop_id) < (iso_table[i+1].prop_id - v))
526  set_iso_mode(i);
527  else
528  set_iso_mode(i+1);
529  return;
530  }
531  }
532  set_iso_mode(ISO_SIZE-1);
533  }
534 }
void shooting_set_iso_real ( short  iso,
short  is_now 
)

Definiert in Zeile 563 der Datei shooting.c.

564 {
566  {
567  if (iso > 0)
568  {
569 #ifdef CAM_ISO_LIMIT_IN_HQ_BURST
570  // Limit max ISO in HQ burst mode
573 #endif
574 #ifdef CAM_MIN_ISO_OVERRIDE
575  // Limit min (non-zero) ISO
577 #endif
578 #ifdef CAM_MAX_ISO_OVERRIDE
579  // Limit max ISO
581 #endif
583  }
584  }
585 }
int shooting_set_mode_canon ( int  canonmode)

Definiert in Zeile 1459 der Datei shooting.c.

1460 {
1461  if (canonmode == -1 || !rec_mode_active())
1462  return 0;
1463  SetCurrentCaptureModeType(canonmode);
1464  // updated cached mode information immediately
1465  mode_get();
1466  return 1;
1467 }
int shooting_set_mode_chdk ( int  mode)

Definiert in Zeile 1469 der Datei shooting.c.

1470 {
1472 }
void shooting_set_nd_filter_state ( short  v,
short  is_now 
)

Definiert in Zeile 947 der Datei shooting.c.

948 {
949 #if CAM_HAS_ND_FILTER
951  {
952  if (is_now)
953  {
954 #if CAM_ND_SET_AV_VALUE == 1
955  short av;
956  get_property_case(PROPCASE_MIN_AV,&av,sizeof(av));
957  if(v==1) {
959  }
960  set_property_case(PROPCASE_AV, &av, sizeof(av));
961 #if defined(PROPCASE_AV2)
962  set_property_case(PROPCASE_AV2, &av, sizeof(av));
963 #endif
964 #endif // CAM_ND_SET_AV_VALUE
965  if (v==1) {
966  PutInNdFilter();
967  }
968  else if (v==2)
969  PutOutNdFilter();
970 #if defined(CAM_HAS_NATIVE_ND_FILTER) && defined(PROPCASE_ND_FILTER_STATE)
971  int n = (v==1) ? 1 : 0;
973 #endif
974  }
975  else
977  }
978 #endif // CAM_HAS_ND_FILTER
979 }
void shooting_set_playrec_mode ( int  mode)

Definiert in Zeile 1988 der Datei shooting.c.

1989 {
1990  // use PTP compatible switch if usb bit power detected, and USB remote not configured to use USB
1991  // TODO should just check the USB bit seen by canon firmware (after masking)
1993  {
1995  return;
1996  }
1997  if(mode)
1999  else
2000  levent_set_play();
2001 }
void shooting_set_prop ( int  id,
int  v 
)

Definiert in Zeile 117 der Datei shooting.c.

118 {
119  short vv = v;
120  set_property_case(id, &vv, sizeof(vv));
121  return;
122 }
void shooting_set_sv96 ( short  sv96,
short  is_now 
)

Definiert in Zeile 536 der Datei shooting.c.

537 {
539  {
540  if (is_now)
541  {
542  while ((shooting_is_flash_ready()!=1) || (focus_busy)) msleep(10);
543 
544  short iso_mode = shooting_get_canon_iso_mode();
545  if (iso_mode >= 50) {
546  // save current ISO mode, to avoid leaving in auto after override done
547  // only needed for non-auto
548  iso_override_mode_save = iso_mode;
549  shooting_set_iso_mode(0); // Force AUTO mode on camera
550  }
551 
552  short dsv96 = sv96 + SV96_MARKET_OFFSET - canon_sv96_base;
553 
554  set_property_case(PROPCASE_SV_MARKET, &canon_sv96_base, sizeof(canon_sv96_base));
555  set_property_case(PROPCASE_SV, &sv96, sizeof(sv96));
556  set_property_case(PROPCASE_DELTA_SV, &dsv96, sizeof(dsv96));
557  }
558  else
559  photo_param_put_off.sv96 = sv96;
560  }
561 }
void shooting_set_tv96 ( short  tv96,
short  is_now 
)

Definiert in Zeile 692 der Datei shooting.c.

693 {
696 }
void shooting_set_tv96_direct ( short  tv96,
short  is_now 
)

Definiert in Zeile 676 der Datei shooting.c.

677 {
679  {
680  if(is_now)
681  {
682  set_property_case(PROPCASE_TV, &tv96, sizeof(tv96));
683 #ifdef PROPCASE_TV2
684  set_property_case(PROPCASE_TV2, &tv96, sizeof(tv96)); // Save override to property that will update JPEG header & Canon OSD
685 #endif
686  }
687  else
688  photo_param_put_off.tv96 = tv96;
689  }
690 }
void shooting_set_user_av96 ( short  av96)

Definiert in Zeile 927 der Datei shooting.c.

928 {
929 #if CAM_HAS_IRIS_DIAPHRAGM
931  {
932  av96 = find_canon_aperture(av96);
933  set_property_case(PROPCASE_USER_AV, &av96, sizeof(av96));
934  }
935 #endif
936 }
void shooting_set_user_av_by_id ( int  v)

Definiert in Zeile 897 der Datei shooting.c.

898 {
899 #if CAM_HAS_IRIS_DIAPHRAGM
900  long i;
902  {
903  for (i=0;i<AS_SIZE;i++)
904  {
905  if (aperture_sizes_table[i].id == v)
906  {
907  short vv = aperture_sizes_table[i].prop_id;
908  set_property_case(PROPCASE_USER_AV, &vv, sizeof(vv));
909  return;
910  }
911  }
912  }
913 #endif
914 }
void shooting_set_user_av_by_id_rel ( int  v)

Definiert in Zeile 916 der Datei shooting.c.

917 {
918 #if CAM_HAS_IRIS_DIAPHRAGM
920  {
921  int cv = shooting_get_user_av_id();
923  }
924 #endif
925 }
void shooting_set_user_tv96 ( short  tv96)

Definiert in Zeile 748 der Datei shooting.c.

749 {
750 #if CAM_HAS_USER_TV_MODES
752  {
753  tv96 = find_canon_shutter_speed(tv96);
754  set_property_case(PROPCASE_USER_TV, &tv96, sizeof(tv96));
755  }
756 #endif
757 }
void shooting_set_user_tv_by_id ( int  v)

Definiert in Zeile 718 der Datei shooting.c.

719 {
720 #if CAM_HAS_USER_TV_MODES
722  {
723  long i;
724  for (i=0;i<SS_SIZE;i++)
725  {
726  if (shutter_speeds_table[i].id == v)
727  {
728  short vv = shutter_speeds_table[i].prop_id;
729  set_property_case(PROPCASE_USER_TV, &vv, sizeof(vv));
730  return;
731  }
732  }
733  }
734 #endif
735 }
void shooting_set_user_tv_by_id_rel ( int  v)

Definiert in Zeile 737 der Datei shooting.c.

738 {
739 #if CAM_HAS_USER_TV_MODES
741  {
742  int cv = shooting_get_user_tv_id();
744  }
745 #endif
746 }
void shooting_set_zoom ( int  v)

Definiert in Zeile 1355 der Datei shooting.c.

1356 {
1358  {
1359 #if CAM_REFOCUS_AFTER_ZOOM
1360  int dist = shooting_get_subject_distance();
1362 #if defined(CAM_NEED_SET_ZOOM_DELAY)
1364 #endif
1365  shooting_set_focus(dist, SET_NOW);
1366 #else // CAM_REFOCUS_AFTER_ZOOM
1368 #endif // CAM_REFOCUS_AFTER_ZOOM
1369  }
1370 }
void shooting_set_zoom_rel ( int  v)

Definiert in Zeile 1372 der Datei shooting.c.

1373 {
1374  int cv = shooting_get_zoom();
1376  {
1377  shooting_set_zoom(cv+v);
1378  }
1379 }
void shooting_set_zoom_speed ( int  v)

Definiert in Zeile 1381 der Datei shooting.c.

1381  {
1383  {
1385  }
1386 }
static void shooting_subject_distance_bracketing ( int  when)
static

Definiert in Zeile 1580 der Datei shooting.c.

1581 {
1582  // first shot? (actually this is called just after the first shot has been taken)
1583  if (bracketing.shoot_counter == 0)
1584  {
1587  }
1588 
1589  // Adjust delta SD value for shot based on shot number
1591  // Calculate new SD
1593  if (value < CAMERA_MIN_DIST) value = CAMERA_MIN_DIST;
1594  else if (value > CAMERA_MAX_DIST) value = CAMERA_MAX_DIST;
1595 
1596  // Inc for next shot
1598 
1599  // Apply value for next shot to be taken
1600  shooting_set_focus(value, when);
1601 }
short shooting_sv96_market_to_real ( short  sv96)

Definiert in Zeile 433 der Datei shooting.c.

434 {
435  return sv96 - SV96_MARKET_OFFSET;
436 }
short shooting_sv96_real_to_market ( short  sv96)

Definiert in Zeile 438 der Datei shooting.c.

439 {
440  return sv96 + SV96_MARKET_OFFSET;
441 }
static void shooting_tv_bracketing ( int  when)
static

Definiert in Zeile 1493 der Datei shooting.c.

1494 {
1495  // first shot? (actually this is called just after the first shot has been taken)
1496  if (bracketing.shoot_counter == 0)
1497  {
1498  // if Tv override is enabled... (this was adapted from function shooting_expo_param_override() )
1500  {
1501  // ...use Tv override value as seed for bracketing:
1503  }
1504  // Tv override is disabled, use camera's opinion of Tv for bracketing seed value.
1505  else
1506  {
1509  else
1511  }
1513  }
1514 
1515  // Adjust delta TV value for shot based on shot number
1517  // Calculate new TV (note, need to subtract delta because higher values are shorter shutter speeds / darker images)
1519 
1520  // Inc for next shot
1522 
1523  // Apply value for next shot to be taken
1524  shooting_set_tv96_direct(value, when);
1525 }
void shooting_update_dof_values ( )

Definiert in Zeile 1184 der Datei shooting.c.

1185 {
1186  int hyp, hyp_1e3, av_1e3, v;
1187  int dist = shooting_get_subject_distance_();
1188  int zoom_point = lens_get_zoom_point();
1189  int fl = get_focal_length(zoom_point);
1190  short f_focus_ok = shooting_get_focus_ok();
1191  short f_hyp_calc = 0, f_dist_calc = 0;
1192  short min_av96_zoom_point = 0;
1193  short av96 = shooting_get_user_av96();
1194  short curr_av96 = shooting_get_current_av96();
1195  short prop_av96 = shooting_get_av96();
1196  short min_av96;
1197 
1198  if (!min_av96_zoom_point_tbl) {
1199  min_av96_zoom_point_tbl = (short *) malloc(zoom_points * sizeof(short));
1201  memset(min_av96_zoom_point_tbl, 0, zoom_points * sizeof(short));
1202  }
1203  else {
1204  return;
1205  }
1206  } else min_av96_zoom_point = min_av96_zoom_point_tbl[zoom_point];
1207 
1208  if (min_av96_zoom_point==0 && shooting_in_progress()) {
1209  get_property_case(PROPCASE_MIN_AV, &min_av96, sizeof(min_av96));
1210  min_av96_zoom_point_tbl[zoom_point] = min_av96;
1211  }
1212 
1213  if ((camera_info.state.mode_shooting==MODE_M || camera_info.state.mode_shooting==MODE_AV) && (av96>0) && !f_focus_ok) {
1214  if (av96 < min_av96_zoom_point) av96 = min_av96_zoom_point;
1215  }
1216  else av96 = (abs(curr_av96-prop_av96)<2)?prop_av96:curr_av96;
1217 
1218  av_1e3 = shooting_get_aperture_from_av96(av96);
1221 
1222  if (camera_info.dof_values.aperture_value!=av_1e3 || camera_info.dof_values.focal_length!=fl || (hyp_1e3<0)) {
1223  //calc new hyperfocal distance and min stack distance
1224  f_hyp_calc = 1;
1225  hyp_1e3 = -1;
1226  hyp = -1;
1229  hyp_1e3 = shooting_get_hyperfocal_distance_1e3_f(av_1e3, fl);
1230  if (hyp_1e3>0) {
1231  hyp = (hyp_1e3+500)/1000;
1233  v = ((hyp_1e3 - fl)/250 + 2 + 1)/2;
1234  if (v>0) {
1235  int m = ((fl*((fl - hyp_1e3)/1000 - 1)/500)/v + 1)/2;
1236  int m2 = (int)((((double)hyp*(2*fl - hyp_1e3)/1000))/v + 0.5);
1238  }
1239  }
1240  }
1241 
1242  if ((camera_info.dof_values.subject_distance!=dist || (camera_info.dof_values.hyperfocal_distance_1e3!=hyp_1e3)) && (hyp_1e3>0)) {
1243  //calc new NEAR, FAR, DOF values
1244  f_dist_calc = 1;
1249  if ((av_1e3>0) && (fl>0) && (dist>0) && (shooting_is_infinity_distance()==0) && (hyp_1e3>0)) {
1250  double m = ((double)(hyp_1e3 - fl)/1000 * dist) + 0.5;
1253  } else {
1254  int v = ((((hyp_1e3 - 2*fl + 1000*dist)/500) + 1)/2);
1255  if (v>0) camera_info.dof_values.near_limit = (int)(m/v);
1256  }
1257  int v = ((((hyp_1e3 - 1000*dist)/500) + 1)/2);
1258  if (v>0) camera_info.dof_values.far_limit = (int)(m/v);
1261  }
1262  }
1263  // if at infinity then set near to hyperfocal value
1264  // note focus beyond infinity is not distinguished from infinity
1267  }
1268  }
1271  f_focus_ok = (f_focus_ok && shooting_get_focus_ok());
1274  return;
1275 }
void shooting_update_state ( void  )

Definiert in Zeile 72 der Datei shooting.c.

73 {
74  // ISO override will set ISO_MODE to auto in halfpress when get_shooting becomes true
75  // or immediately if already in shooting or raw hook for bracketing
76  // if existing ISO mode is not auto, it will be saved to iso_override_mode_save
77  // restore when shooting goes to false
81  }
82 
83 #ifdef OPT_VIEWPORT_DEBUG
84  extern volatile char active_viewport_buffer;
85  long avb_ts;
86  char avb_v;
87  avb_ts = get_tick_count();
88  avb_v = active_viewport_buffer;
89  if (avb_v != avb_pv) {
90  avb_history[avb_hp] = avb_v;
91  avb_times[avb_hp] = avb_ts - avb_pts;
92  avb_hp = (avb_hp+1) & 31;
93  avb_pts = avb_ts;
94  avb_pv = avb_v;
95  }
96 #endif
97 
98 }
void shooting_video_bitrate_change ( int  v)

Definiert in Zeile 1414 der Datei shooting.c.

1415 {
1416 #if CAM_CHDK_HAS_EXT_VIDEO_MENU
1417  int m[]={1,2,3,4,5,6,7,8,10,12}; // m[v]/4 = bitrate*1x
1418  if (v>=(sizeof(m)/sizeof(m[0])))
1419  v=(sizeof(m)/sizeof(m[0]))-1;
1420  change_video_tables(m[v],4);
1421 #endif
1422 }
void unlock_optical_zoom ( void  )

Definiert in Zeile 1446 der Datei shooting.c.

1447 {
1448 #if CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
1449  extern void UnsetZoomForMovie();
1451  UnsetZoomForMovie();
1452 #endif
1453 
1454 #if CAM_EV_IN_VIDEO
1455  set_ev_video_avail(0);
1456 #endif
1457 }

Variablen-Dokumentation

const ApertureSize aperture_sizes_table[]

pt=require'extras/proptools'

Definiert in Zeile 9 der Datei shooting.c.

const unsigned int AS_SIZE

Definiert in Zeile 18 der Datei shooting.c.

int bracket_delta[4][2]
static
Initialisierung:
= {
{ 1, 0 },
{ 1, 1 },
{ 1, 1 },
{ 1, 0 },
}

Definiert in Zeile 1486 der Datei shooting.c.

int bracket_steps[4][2]
static
Initialisierung:
= {
{ 1, -1 },
{ -1, -1 },
{ 1, 1 },
{ -1, 1 },
}

Definiert in Zeile 1480 der Datei shooting.c.

Definiert in Zeile 1477 der Datei shooting.c.

short canon_iso_base =0
static

Definiert in Zeile 388 der Datei shooting.c.

short canon_sv96_base =0
static

Definiert in Zeile 389 der Datei shooting.c.

volatile long focus_busy
int focus_interlock_bypass = 0
static

Definiert in Zeile 1289 der Datei shooting.c.

const double inv_log_2 = 1.44269504088906
static

Definiert in Zeile 59 der Datei shooting.c.

int iso_override_mode_save = 0
static

Definiert in Zeile 53 der Datei shooting.c.

const unsigned int ISO_SIZE

Definiert in Zeile 19 der Datei shooting.c.

const ISOTable iso_table[]

Definiert in Zeile 71 der Datei shooting.c.

const double K = 12.5
static

Definiert in Zeile 1071 der Datei shooting.c.

short* min_av96_zoom_point_tbl = NULL
static

Definiert in Zeile 36 der Datei shooting.c.

const CapturemodeMap modemap[]

Definiert in Zeile 82 der Datei shooting.c.

const unsigned int MODESCNT

Definiert in Zeile 20 der Datei shooting.c.

int movie_status

Definiert in Zeile 72 der Datei lib.c.

const unsigned int param_file_counter

Definiert in Zeile 23 der Datei shooting.c.

PHOTO_PARAM photo_param_put_off
static

Definiert in Zeile 49 der Datei shooting.c.

long playrec_mode
const ShutterSpeed shutter_speeds_table[]

Definiert in Zeile 22 der Datei shooting.c.

const unsigned int SS_SIZE

Definiert in Zeile 17 der Datei shooting.c.