CHDK_DE Vorschauversion  Trunk Rev. 5821
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
shooting.c-Dateireferenz
#include "platform.h"
#include "keyboard.h"
#include "math.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 782 der Datei shooting.c.

#define AV96_MIN   (aperture_sizes_table[0].prop_id)

Definiert in Zeile 781 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 405 der Datei shooting.c.

#define ISO_MARKET_TO_REAL_MULT   9955

Definiert in Zeile 397 der Datei shooting.c.

#define ISO_MARKET_TO_REAL_ROUND   8192

Definiert in Zeile 399 der Datei shooting.c.

#define ISO_MARKET_TO_REAL_SHIFT   14

Definiert in Zeile 398 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 406 der Datei shooting.c.

#define ISO_REAL_TO_MARKET_MULT   3371

Definiert in Zeile 400 der Datei shooting.c.

#define ISO_REAL_TO_MARKET_ROUND   1024

Definiert in Zeile 402 der Datei shooting.c.

#define ISO_REAL_TO_MARKET_SHIFT   11

Definiert in Zeile 401 der Datei shooting.c.

#define PHOTO_PARAM_TV_NONE   32767

Definiert in Zeile 38 der Datei shooting.c.

#define SV96_MARKET_OFFSET   69

Definiert in Zeile 392 der Datei shooting.c.

#define tv_override_zero_shift   18

Definiert in Zeile 631 der Datei shooting.c.

Dokumentation der Funktionen

int __attribute__ ( (weak)  )

Definiert in Zeile 1775 der Datei shooting.c.

1776 {
1777  return (playrec_mode==2 || playrec_mode==4 || playrec_mode==5);
1778 }
void bracketing_reset ( )

Definiert in Zeile 1622 der Datei shooting.c.

void bracketing_step ( int  when)

Definiert in Zeile 1629 der Datei shooting.c.

int captseq_hack_override_active ( )

Definiert in Zeile 1657 der Datei shooting.c.

1658 {
1661  return 1;
1662 #if CAM_HAS_IRIS_DIAPHRAGM
1664  return 1;
1665 #endif
1666  }
1667  if(conf.override_disable==1)
1668  return 0;
1670  return 1;
1672  return 1;
1673 #if CAM_HAS_IRIS_DIAPHRAGM
1675  return 1;
1676 #endif
1677  return 0;
1678 }
static short find_canon_shutter_speed ( short  tv96)
static

Definiert in Zeile 670 der Datei shooting.c.

static int find_nearest_shutter_speed_entry ( short  tv96)
static

Definiert in Zeile 649 der Datei shooting.c.

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

Definiert in Zeile 1069 der Datei shooting.c.

1070 {
1071  long v = 0;
1073  v = ((v>>4)&0x3FFF);
1074  return v;
1075 }
long get_file_counter ( )

Definiert in Zeile 1062 der Datei shooting.c.

1063 {
1064  long v = 0;
1066  return v;
1067 }
int get_movie_status ( )

Definiert in Zeile 1716 der Datei shooting.c.

1717 {
1718 #ifndef CAM_SIMPLE_MOVIE_STATUS
1719  return movie_status;
1720 #else
1721  // firmware movie_status interpreted as: zero - not recording, nonzero - recording
1722  return simple_movie_status?VIDEO_RECORD_IN_PROGRESS:VIDEO_RECORD_STOPPED;
1723 #endif
1724 }
void get_target_dir_name ( char *  dir)

Definiert in Zeile 1079 der Datei shooting.c.

1079  {
1080  extern long get_target_dir_num();
1081  sprintf(dir,"A/DCIM/%03dCANON",get_target_dir_num());
1082 }
int is_video_recording ( )

Definiert in Zeile 1727 der Datei shooting.c.

1728 {
1729 #ifndef CAM_SIMPLE_MOVIE_STATUS
1730 #if defined(CAM_HAS_MOVIE_DIGEST_MODE)
1731  // If camera has movie digest mode then movie_status values are different than previous models
1732  // 'movie_status' values
1733  // 0 - after startup
1734  // 1 - movie recording stopped
1735  // 4 - movie recording in progress, or in 'movie digest' scene mode
1736  // 5 - movie recording stopping
1737  // 6 - in video mode, not recording
1739 #else
1740  // 'movie_status' values
1741  // 0 - after startup
1742  // 1 - movie recording stopped
1743  // 4 - movie recording in progress
1744  // 5 - movie recording stopping
1745  return (movie_status > 1);
1746 #endif
1747 #else // CAM_SIMPLE_MOVIE_STATUS
1748  return (simple_movie_status!=0);
1749 #endif
1750 }
static void iso_init ( )
static

Definiert in Zeile 586 der Datei shooting.c.

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

Definiert in Zeile 1780 der Datei shooting.c.

1781 {
1782  int mode, t=0xFF;
1783 
1784  mode = (rec_mode_active())?MODE_REC:MODE_PLAY;
1785 
1786 #ifdef CAM_SWIVEL_SCREEN
1787  extern int screen_opened(void); // 0 not open, non-zero open
1788  extern int screen_rotated(void); // 0 not rotated, non-zero rotated
1789 
1790  mode |= (screen_opened())?MODE_SCREEN_OPENED:0;
1791  mode |= (screen_rotated())?MODE_SCREEN_ROTATED:0;
1792 #endif
1793 
1794 #ifdef CAM_SUPPORT_BITMAP_RES_CHANGE
1795  extern void update_screen_dimensions();
1797 #endif
1798 
1800 #ifdef CAM_MASK_VID_REC_ACTIVE
1802 #else
1803  mode |= shooting_mode_canon2chdk(t);
1804 #endif
1805 
1806  // Set camera state variables from mode info
1810  camera_info.state.mode_rec = ((mode & MODE_MASK) == MODE_REC);
1812  camera_info.state.mode_play = ((mode & MODE_MASK) == MODE_PLAY);
1814 
1815  return (mode);
1816 }
int mode_is_video ( int  m)

Definiert in Zeile 1753 der Datei shooting.c.

1754 {
1755  m = m & MODE_SHOOTING_MASK;
1756  return (m==MODE_VIDEO_STD ||
1757  m==MODE_VIDEO_SPEED ||
1758  m==MODE_VIDEO_COMPACT ||
1765  m==MODE_VIDEO_M ||
1769  // not clear if this should be considered a video mode ?
1770  // m==MODE_VIDEO_MOVIE_DIGEST
1771  );
1772 }
int rec_mode_active ( void  )

Definiert in Zeile 223 der Datei main.c.

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

Definiert in Zeile 1135 der Datei shooting.c.

1136 { return ( 0
1137 #ifdef CAM_SD_OVER_IN_AF
1138  + 1
1139 #endif
1140 #ifdef CAM_SD_OVER_IN_AFL
1141  + 2
1142 #endif
1143 #ifdef CAM_SD_OVER_IN_MF
1144  + 4
1145 #endif
1146 ); }
void set_focus_bypass ( int  m)

Definiert in Zeile 1406 der Datei shooting.c.

1407 {
1409 }
static void set_iso_mode ( int  i)
static

Definiert in Zeile 493 der Datei shooting.c.

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

Definiert in Zeile 1686 der Datei shooting.c.

1687 {
1688 #ifndef CAM_SIMPLE_MOVIE_STATUS
1689  switch(status)
1690  {
1691  case 1:
1693  {
1695  }
1696  break;
1697  case 2:
1699  {
1701  }
1702  break;
1703  case 3:
1705  {
1707  }
1708  break;
1709  }
1710 #else // CAM_SIMPLE_MOVIE_STATUS
1711  // no known way to control the recording process
1712  (void)status;
1713 #endif
1714 }
static void shooting_av_bracketing ( int  when)
static

Definiert in Zeile 1546 der Datei shooting.c.

1547 {
1548  // first shot? (actually this is called just after the first shot has been taken)
1549  if (bracketing.shoot_counter == 0)
1550  {
1553  else
1556  }
1557 
1558  // Adjust delta AV value for shot based on shot number
1560  // Calculate new AV (note, need to subtract delta because higher values are smaller apertures / darker images)
1562 
1563  // Inc for next shot
1565 
1566  // Apply value for next shot to be taken
1567  if (value != bracketing.av96)
1568  {
1569  shooting_set_av96_direct(value, when);
1570 #ifdef CAM_AV_OVERRIDE_IRIS_FIX
1571  extern int MoveIrisWithAv(short*);
1572  MoveIrisWithAv(&value);
1573 #endif
1574  }
1575 }
void shooting_bracketing ( void  )

Definiert in Zeile 1637 der Datei shooting.c.

short shooting_can_focus ( )

Definiert in Zeile 1308 der Datei shooting.c.

1309 {
1310  if(camera_info.state.mode_play) return 0 ; // don't focus in playback mode
1311 
1312  if(focus_interlock_bypass) return 1; // checks disabled, allow
1313 
1314  if( camera_info.state.mode_video == 1) return 1; // FIXME : default to MF enabled in video mode for now
1315 
1316 #ifdef CAM_SD_OVER_IN_AFL
1317  if (shooting_get_prop(PROPCASE_AF_LOCK)==1 ) return 1; // allow focus if AFL enabled and camera can focus that way?
1318 #endif
1319 #ifdef CAM_SD_OVER_IN_MF
1320  if (shooting_get_prop(PROPCASE_FOCUS_MODE)==1 ) return 1; // allow focus if MF enabled and camera can focus that way?
1321 #endif
1322 
1323 #ifdef CAM_SD_OVER_IN_AF
1324 #ifdef PROPCASE_CONTINUOUS_AF
1325  if (shooting_get_prop(PROPCASE_CONTINUOUS_AF)) return 0; // don't focus in continuous AF mode,
1326 #endif
1327 #ifdef PROPCASE_SERVO_AF
1328  if (shooting_get_prop(PROPCASE_SERVO_AF)) return 0; // don't focus in servo AF mode
1329 #endif
1330  if ( (shooting_get_prop(PROPCASE_AF_LOCK)==0) // allow focus when in AF mode (i.e AFL or MF not enabled)?
1331  && (shooting_get_prop(PROPCASE_FOCUS_MODE)==0 )) return 1;
1332 #endif
1333  return 0;
1334 }
void shooting_expo_iso_override_thumb ( void  )

Definiert in Zeile 1978 der Datei shooting.c.

1979 {
1981  {
1983  // photo_param_put_off.sv96 is not reset here, it will be reset in next call to shooting_expo_param_override
1984  }
1985  else if (is_iso_override_enabled)
1989 
1990 #if defined(CAM_HAS_ND_FILTER) && defined(CAM_HAS_NATIVE_ND_FILTER)
1992  {
1994  //photo_param_put_off.nd_filter=0;
1995  }
1996  else if (conf.nd_filter_state && !(conf.override_disable==1))
1998 #endif
1999 
2000  // Set flash mode & override
2002 }
void shooting_expo_param_override_thumb ( void  )

Definiert in Zeile 1912 der Datei shooting.c.

1913 {
1915  {
1918  }
1919  else if (is_tv_override_enabled)
1920  {
1922  }
1923 
1925  {
1928  }
1929  else if (is_iso_override_enabled)
1933 
1935  {
1938  }
1939  else if (is_av_override_enabled)
1941 
1943  {
1946  }
1947  else if (is_sd_override_enabled)
1949 
1950 #if CAM_HAS_ND_FILTER
1952  {
1955  }
1956  else if (conf.nd_filter_state && !(conf.override_disable==1))
1958 #endif
1959 
1960 #if CAM_REAR_CURTAIN
1961  shooting_set_flash_sync_curtain(conf.flash_sync_curtain);
1962 #endif
1963 
1964  // Set flash mode & override
1966 
1967 #if CAM_QUALITY_OVERRIDE
1968  // this doesn't really need to be set in the override hook.
1969  // should only need to be set once if the users doesn't change back, but doing it here ensures it is set
1970  shooting_set_image_quality(conf.fast_image_quality);
1971 #endif
1972 
1974 }
int shooting_get_analog_video_standard ( void  )

Definiert in Zeile 232 der Datei shooting.c.

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

Definiert in Zeile 789 der Datei shooting.c.

790 {
791  if (av96)
792  return (short)((pow(2, ((double)av96)/192.0))*1000.0 + 0.5);
793  return -1;
794 }
short shooting_get_aperture_sizes_table_size ( )

Definiert in Zeile 785 der Datei shooting.c.

785 { return AS_SIZE; }
short shooting_get_av96 ( )

Definiert in Zeile 784 der Datei shooting.c.

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

Definiert in Zeile 796 der Datei shooting.c.

797 {
798  return (int)((log((double)aperture/1000.0) * 192 * inv_log_2) + 0.5);
799 }
short shooting_get_av96_override_value ( )

Definiert in Zeile 802 der Datei shooting.c.

803 {
804  if (conf.av_override_value<(int)AS_SIZE)
806  return (short) (AV96_MAX+32*(conf.av_override_value-AS_SIZE+1));
807 }
short shooting_get_bv96 ( )

Definiert in Zeile 124 der Datei shooting.c.

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

Definiert in Zeile 138 der Datei shooting.c.

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

Definiert in Zeile 381 der Datei shooting.c.

short shooting_get_canon_overexposure_value ( )

Definiert in Zeile 125 der Datei shooting.c.

int shooting_get_canon_subject_distance ( )

Definiert in Zeile 1185 der Datei shooting.c.

1186 {
1189  else
1190  return (lens_get_focus_pos_from_lens());
1191 }
short shooting_get_common_focus_mode ( )

Definiert in Zeile 1336 der Datei shooting.c.

1337 {
1338 #if !CAM_HAS_MANUAL_FOCUS
1339  return conf.subj_dist_override_koef; // SD override state 0=OFF, 1=ON, 2=Infinity if camera has no native MF mode
1340 #else
1341  return shooting_get_focus_mode(); // 0=Auto, 1=manual
1342 #endif
1343 }
int shooting_get_digital_zoom_state ( void  )

Definiert in Zeile 260 der Datei shooting.c.

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

Definiert in Zeile 131 der Datei shooting.c.

short shooting_get_drive_mode ( )

Definiert in Zeile 301 der Datei shooting.c.

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

Definiert in Zeile 128 der Datei shooting.c.

short shooting_get_ev_correction2 ( )

Definiert in Zeile 129 der Datei shooting.c.

int shooting_get_exif_subject_dist ( )

Definiert in Zeile 133 der Datei shooting.c.

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

Definiert in Zeile 1170 der Datei shooting.c.

1171 {
1172  if (shooting_is_infinity_distance()) return (-1);
1174  double m = ((double)(h_1e3 - fl)+500)/1000*s;
1175  int v = ((h_1e3 - 1000*s)+500)/1000;
1176  if ((m>0) && (v>0)) return (int)((2*m/v+1)/2);
1177  else return (-1);
1178 }
short shooting_get_flash_mode ( )

Definiert in Zeile 126 der Datei shooting.c.

short shooting_get_focus_mode ( )

Definiert in Zeile 127 der Datei shooting.c.

short shooting_get_focus_ok ( )

Definiert in Zeile 296 der Datei shooting.c.

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

Definiert in Zeile 289 der Datei shooting.c.

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

Definiert in Zeile 1300 der Datei shooting.c.

1301 {
1304 }
int shooting_get_hyperfocal_distance_1e3_f ( int  av,
int  fl 
)

Definiert in Zeile 1153 der Datei shooting.c.

1154 {
1155  if ((av>0) && (fl>0) && (camera_info.circle_of_confusion>0))
1156  return (int)(((((double)fl*fl)/(av*camera_info.circle_of_confusion)*1000)+fl)+0.5);
1157  else return (-1);
1158 }
int shooting_get_imager_active ( )

Definiert in Zeile 221 der Datei shooting.c.

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

Definiert in Zeile 123 der Datei shooting.c.

short shooting_get_iso_from_sv96 ( short  sv96)

Definiert in Zeile 416 der Datei shooting.c.

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

Definiert in Zeile 485 der Datei shooting.c.

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

Definiert in Zeile 464 der Datei shooting.c.

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

Definiert in Zeile 442 der Datei shooting.c.

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

Definiert in Zeile 476 der Datei shooting.c.

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

Definiert in Zeile 1148 der Datei shooting.c.

1149 {
1151 }
int shooting_get_luminance ( )

Definiert in Zeile 1090 der Datei shooting.c.

1091 {
1092  short bv = shooting_get_bv96();
1093  int b = (int)(100 * K * pow(2.0,((double)(bv-168)/96.0)));
1094  return b;
1095 }
short shooting_get_max_av96 ( )

Definiert in Zeile 1017 der Datei shooting.c.

1018 {
1019 #if CAM_HAS_IRIS_DIAPHRAGM
1020  extern short GetUsableMinAv(void);
1022  {
1023  return -1;
1024  }
1025  return GetUsableMinAv();
1026 #else
1027  return -1;
1028 #endif
1029 }
short shooting_get_min_av96 ( )

Definiert in Zeile 1003 der Datei shooting.c.

1004 {
1005 #if CAM_HAS_IRIS_DIAPHRAGM
1006  extern short GetUsableMaxAv(void);
1008  {
1009  return -1;
1010  }
1011  return GetUsableMaxAv();
1012 #else
1013  return -1;
1014 #endif
1015 }
static int shooting_get_min_real_aperture ( )
static

Definiert in Zeile 814 der Datei shooting.c.

815 {
816  short av96;
817  get_property_case(PROPCASE_MIN_AV, &av96, sizeof(av96));
818  if (av96)
819  return shooting_get_aperture_from_av96(av96);
821 }
int shooting_get_near_limit_f ( int  s,
int  av,
int  fl 
)

Definiert in Zeile 1160 der Datei shooting.c.

1161 {
1162  if (shooting_is_infinity_distance()) return (-1);
1164  double m = ((double)(h_1e3 - fl)+500)/1000*s;
1165  int v = ((h_1e3 - 2*fl + 1000*s)+500)/1000;
1166  if ((m>0) && (v>0)) return (int)((2*m/v+1)/2);
1167  else return (-1);
1168 }
int shooting_get_prop ( int  id)

Definiert in Zeile 102 der Datei shooting.c.

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

Definiert in Zeile 109 der Datei shooting.c.

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

Definiert in Zeile 809 der Datei shooting.c.

short shooting_get_real_focus_mode ( )

Definiert in Zeile 281 der Datei shooting.c.

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

Definiert in Zeile 130 der Datei shooting.c.

float shooting_get_shutter_speed_from_tv96 ( short  tv96)

Definiert in Zeile 622 der Datei shooting.c.

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

Definiert in Zeile 1294 der Datei shooting.c.

1295 {
1298 }
int shooting_get_subject_distance_ ( )
int shooting_get_subject_distance_override_value ( )
short shooting_get_sv96_delta ( )

Definiert in Zeile 384 der Datei shooting.c.

short shooting_get_sv96_from_iso ( short  iso)

Definiert in Zeile 408 der Datei shooting.c.

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

Definiert in Zeile 382 der Datei shooting.c.

short shooting_get_sv96_real ( )

Definiert in Zeile 383 der Datei shooting.c.

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

Definiert in Zeile 606 der Datei shooting.c.

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

Definiert in Zeile 610 der Datei shooting.c.

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

Definiert in Zeile 635 der Datei shooting.c.

636 {
637  // Calculate the tv96 value for the tv override
642  else
644 }
short shooting_get_user_av96 ( )

Definiert in Zeile 888 der Datei shooting.c.

889 {
890 #if CAM_HAS_IRIS_DIAPHRAGM
892 #else
893  return 0;
894 #endif
895 }
int shooting_get_user_av_id ( )

Definiert in Zeile 897 der Datei shooting.c.

898 {
899 #if CAM_HAS_IRIS_DIAPHRAGM
900  return aperture_sizes_table[find_nearest_aperture_entry(shooting_get_user_av96())].prop_id;
901 #else
902  return 0;
903 #endif
904 }
short shooting_get_user_tv96 ( )

Definiert in Zeile 699 der Datei shooting.c.

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

Definiert in Zeile 708 der Datei shooting.c.

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

Definiert in Zeile 317 der Datei shooting.c.

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

Definiert in Zeile 135 der Datei shooting.c.

void shooting_init ( )

Definiert in Zeile 1038 der Datei shooting.c.

1039 {
1041  iso_init();
1042 }
int shooting_is_flash ( )

Definiert in Zeile 134 der Datei shooting.c.

int shooting_is_flash_ready ( )

Definiert in Zeile 1345 der Datei shooting.c.

1346 {
1347  int t = shooting_get_flash_mode();
1348  if ((t != 2) && (shooting_in_progress()))
1349  if (shooting_is_flash())
1350  return IsStrobeChargeCompleted();
1351  return 1;
1352 }
short shooting_is_infinity_distance ( )

Definiert in Zeile 1180 der Datei shooting.c.

1181 {
1182  return (shooting_get_lens_to_focal_plane_width() == 0)?1:0;
1183 }
static void shooting_iso_bracketing ( int  when)
static

Definiert in Zeile 1577 der Datei shooting.c.

1578 {
1579  // first shot? (actually this is called just after the first shot has been taken)
1580  if (bracketing.shoot_counter == 0)
1581  {
1584  }
1585 
1586  // Adjust delta ISO value for shot based on shot number
1588  // Calculate new ISO (higher ISO = brighter image)
1590  if (value <= 0) value = 50;
1591 
1592  // Inc for next shot
1594 
1595  // Apply value for next shot to be taken
1596  shooting_set_iso_real(value, when);
1597 }
short shooting_iso_market_to_real ( short  isom)

Definiert in Zeile 422 der Datei shooting.c.

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

Definiert in Zeile 427 der Datei shooting.c.

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

Definiert in Zeile 1111 der Datei shooting.c.

1112 {
1113  unsigned i;
1114  for (i=0; i < MODESCNT; i++)
1115  {
1116  if (modemap[i].canonmode == canonmode)
1117  return modemap[i].hackmode;
1118  }
1119  return 0;
1120 }
int shooting_mode_chdk2canon ( int  hackmode)

Definiert in Zeile 1122 der Datei shooting.c.

1123 {
1124  unsigned i;
1125  for (i=0; i < MODESCNT; i++)
1126  {
1127  if (modemap[i].hackmode == hackmode)
1128  return modemap[i].canonmode;
1129  }
1130  return -1; // 0 is a valid mode on old cameras!
1131 }
void shooting_set_av96 ( short  av96,
short  is_now 
)

Definiert in Zeile 876 der Datei shooting.c.

877 {
878 #if CAM_HAS_IRIS_DIAPHRAGM
880  shooting_set_av96_direct(find_canon_aperture(av96), is_now);
881 #else
882  (void)av96; (void)is_now;
883 #endif
884 }
void shooting_set_av96_direct ( short  av96,
short  is_now 
)

Definiert in Zeile 856 der Datei shooting.c.

857 {
858 #if CAM_HAS_IRIS_DIAPHRAGM
860  {
861  if(is_now)
862  {
863  set_property_case(PROPCASE_AV, &av96, sizeof(av96));
864 #ifdef PROPCASE_AV2
865  set_property_case(PROPCASE_AV2, &av96, sizeof(av96)); // Save override to property that will update JPEG header & Canon OSD
866 #endif
867  }
868  else
869  photo_param_put_off.av96 = av96;
870  }
871 #else
872  (void)av96; (void)is_now;
873 #endif
874 }
int shooting_set_canon_image_format ( int  fmt)

Definiert in Zeile 165 der Datei shooting.c.

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

Definiert in Zeile 1880 der Datei shooting.c.

1881 {
1882  int mode, flash, power;
1883  flash = 1;
1884 
1885  // Set flash mode & override
1887  {
1889  {
1890  mode = 1; // Manual flash
1892  set_property_case(PROPCASE_FLASH_ADJUST_MODE, &mode, sizeof(mode));
1893  set_property_case(PROPCASE_FLASH_FIRE, &flash, sizeof(flash));
1894  set_property_case(PROPCASE_FLASH_MANUAL_OUTPUT, &power, sizeof(power));
1895  }
1896  else if (conf.flash_enable_exp_comp)
1897  {
1898  mode = 0; // Auto flash
1899  power = (conf.flash_exp_comp - 9) * 32;
1900  set_property_case(PROPCASE_FLASH_ADJUST_MODE, &mode, sizeof(mode));
1901  set_property_case(PROPCASE_FLASH_FIRE, &flash, sizeof(flash));
1902 #if defined(PROPCASE_FLASH_EXP_COMP)
1903  set_property_case(PROPCASE_FLASH_EXP_COMP, &power, sizeof(power));
1904 #endif
1905 #if defined(PROPCASE_EXT_FLASH_EXP_COMP)
1906  set_property_case(PROPCASE_EXT_FLASH_EXP_COMP, &power, sizeof(power));
1907 #endif
1908  }
1909  }
1910 }
void shooting_set_focus ( int  v,
short  is_now 
)

Definiert in Zeile 1411 der Datei shooting.c.

1412 {
1413  int s=v;
1415  {
1416  if (is_now && shooting_can_focus())
1417  {
1419  {
1421  }
1422  if (!conf.dof_use_exif_subj_dist && (s != (int)INFINITY_DIST))
1424  lens_set_focus_pos(s);
1425  }
1426  else
1428  }
1429 }
void shooting_set_iso_mode ( int  v)

Definiert in Zeile 499 der Datei shooting.c.

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

Definiert in Zeile 562 der Datei shooting.c.

563 {
565  {
566  if (iso > 0)
567  {
568 #ifdef CAM_ISO_LIMIT_IN_HQ_BURST
569  // Limit max ISO in HQ burst mode
572 #endif
573 #ifdef CAM_MIN_ISO_OVERRIDE
574  // Limit min (non-zero) ISO
576 #endif
577 #ifdef CAM_MAX_ISO_OVERRIDE
578  // Limit max ISO
580 #endif
582  }
583  }
584 }
int shooting_set_mode_canon ( int  canonmode)

Definiert in Zeile 1478 der Datei shooting.c.

1479 {
1480  if (canonmode == -1 || !rec_mode_active())
1481  return 0;
1482  SetCurrentCaptureModeType(canonmode);
1483  // updated cached mode information immediately
1484  mode_get();
1485  return 1;
1486 }
int shooting_set_mode_chdk ( int  mode)

Definiert in Zeile 1488 der Datei shooting.c.

1489 {
1491 }
void shooting_set_nd_filter_state ( short  v,
short  is_now 
)

Definiert in Zeile 962 der Datei shooting.c.

963 {
964 #if CAM_HAS_ND_FILTER
966  {
967  if (is_now)
968  {
969 #if CAM_ND_SET_AV_VALUE == 1
970  short av;
971  get_property_case(PROPCASE_MIN_AV,&av,sizeof(av));
972  if(v==1) {
974  }
975  set_property_case(PROPCASE_AV, &av, sizeof(av));
976 #if defined(PROPCASE_AV2)
977  set_property_case(PROPCASE_AV2, &av, sizeof(av));
978 #endif
979 #endif // CAM_ND_SET_AV_VALUE
980  if (v==1) {
981  PutInNdFilter();
982  }
983  else if (v==2)
984  PutOutNdFilter();
985 #if defined(CAM_HAS_NATIVE_ND_FILTER) && defined(PROPCASE_ND_FILTER_STATE)
986  int n = (v==1) ? 1 : 0;
988 #endif
989  }
990  else
992  }
993 #else
994  (void)v; (void)is_now;
995 #endif // CAM_HAS_ND_FILTER
996 }
void shooting_set_playrec_mode ( int  mode)

Definiert in Zeile 2008 der Datei shooting.c.

2009 {
2010  // use PTP compatible switch if Canon firmware would see USB bit set
2011  // NOTE this does not detect PTP/IP, which also requires the "usb" logic
2012  if (get_usb_bit_physw_mod())
2013  {
2015  return;
2016  }
2017  if(mode)
2019  else
2020  levent_set_play();
2021 }
void shooting_set_prop ( int  id,
int  v 
)

Definiert in Zeile 116 der Datei shooting.c.

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

Definiert in Zeile 535 der Datei shooting.c.

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

Definiert in Zeile 691 der Datei shooting.c.

692 {
695 }
void shooting_set_tv96_direct ( short  tv96,
short  is_now 
)

Definiert in Zeile 675 der Datei shooting.c.

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

Definiert in Zeile 940 der Datei shooting.c.

941 {
942 #if CAM_HAS_IRIS_DIAPHRAGM
944  {
945  av96 = find_canon_aperture(av96);
946  set_property_case(PROPCASE_USER_AV, &av96, sizeof(av96));
947  }
948 #else
949  (void)av96;
950 #endif
951 }
void shooting_set_user_av_by_id ( int  v)

Definiert in Zeile 906 der Datei shooting.c.

907 {
908 #if CAM_HAS_IRIS_DIAPHRAGM
909  unsigned i;
911  {
912  for (i=0;i<AS_SIZE;i++)
913  {
914  if (aperture_sizes_table[i].id == v)
915  {
916  short vv = aperture_sizes_table[i].prop_id;
917  set_property_case(PROPCASE_USER_AV, &vv, sizeof(vv));
918  return;
919  }
920  }
921  }
922 #else
923  (void)v;
924 #endif
925 }
void shooting_set_user_av_by_id_rel ( int  v)

Definiert in Zeile 927 der Datei shooting.c.

928 {
929 #if CAM_HAS_IRIS_DIAPHRAGM
931  {
932  int cv = shooting_get_user_av_id();
934  }
935 #else
936  (void)v;
937 #endif
938 }
void shooting_set_user_tv96 ( short  tv96)

Definiert in Zeile 751 der Datei shooting.c.

752 {
753 #if CAM_HAS_USER_TV_MODES
755  {
756  tv96 = find_canon_shutter_speed(tv96);
757  set_property_case(PROPCASE_USER_TV, &tv96, sizeof(tv96));
758  }
759 #else
760  (void)tv96;
761 #endif
762 }
void shooting_set_user_tv_by_id ( int  v)

Definiert in Zeile 717 der Datei shooting.c.

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

Definiert in Zeile 738 der Datei shooting.c.

739 {
740 #if CAM_HAS_USER_TV_MODES
742  {
743  int cv = shooting_get_user_tv_id();
745  }
746 #else
747  (void)v;
748 #endif
749 }
void shooting_set_zoom ( int  v)

Definiert in Zeile 1372 der Datei shooting.c.

1373 {
1375  {
1376 #if CAM_REFOCUS_AFTER_ZOOM
1377  int dist = shooting_get_subject_distance();
1379 #if defined(CAM_NEED_SET_ZOOM_DELAY)
1381 #endif
1382  shooting_set_focus(dist, SET_NOW);
1383 #else // CAM_REFOCUS_AFTER_ZOOM
1385 #endif // CAM_REFOCUS_AFTER_ZOOM
1386  }
1387 }
void shooting_set_zoom_rel ( int  v)

Definiert in Zeile 1389 der Datei shooting.c.

1390 {
1391  int cv = shooting_get_zoom();
1393  {
1394  shooting_set_zoom(cv+v);
1395  }
1396 }
void shooting_set_zoom_speed ( int  v)

Definiert in Zeile 1398 der Datei shooting.c.

1398  {
1400  {
1402  }
1403 }
static void shooting_subject_distance_bracketing ( int  when)
static

Definiert in Zeile 1599 der Datei shooting.c.

1600 {
1601  // first shot? (actually this is called just after the first shot has been taken)
1602  if (bracketing.shoot_counter == 0)
1603  {
1606  }
1607 
1608  // Adjust delta SD value for shot based on shot number
1610  // Calculate new SD
1612  if (value < CAMERA_MIN_DIST) value = CAMERA_MIN_DIST;
1613  else if (value > CAMERA_MAX_DIST) value = CAMERA_MAX_DIST;
1614 
1615  // Inc for next shot
1617 
1618  // Apply value for next shot to be taken
1619  shooting_set_focus(value, when);
1620 }
short shooting_sv96_market_to_real ( short  sv96)

Definiert in Zeile 432 der Datei shooting.c.

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

Definiert in Zeile 437 der Datei shooting.c.

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

Definiert in Zeile 1512 der Datei shooting.c.

1513 {
1514  // first shot? (actually this is called just after the first shot has been taken)
1515  if (bracketing.shoot_counter == 0)
1516  {
1517  // if Tv override is enabled... (this was adapted from function shooting_expo_param_override() )
1519  {
1520  // ...use Tv override value as seed for bracketing:
1522  }
1523  // Tv override is disabled, use camera's opinion of Tv for bracketing seed value.
1524  else
1525  {
1528  else
1530  }
1532  }
1533 
1534  // Adjust delta TV value for shot based on shot number
1536  // Calculate new TV (note, need to subtract delta because higher values are shorter shutter speeds / darker images)
1538 
1539  // Inc for next shot
1541 
1542  // Apply value for next shot to be taken
1543  shooting_set_tv96_direct(value, when);
1544 }
void shooting_update_dof_values ( )

Definiert in Zeile 1201 der Datei shooting.c.

1202 {
1203  int hyp, hyp_1e3, av_1e3, v;
1204  int dist = shooting_get_subject_distance_();
1205  int zoom_point = lens_get_zoom_point();
1206  int fl = get_focal_length(zoom_point);
1207  short f_focus_ok = shooting_get_focus_ok();
1208  short f_hyp_calc = 0, f_dist_calc = 0;
1209  short min_av96_zoom_point = 0;
1210  short av96 = shooting_get_user_av96();
1211  short curr_av96 = shooting_get_current_av96();
1212  short prop_av96 = shooting_get_av96();
1213  short min_av96;
1214 
1215  if (!min_av96_zoom_point_tbl) {
1216  min_av96_zoom_point_tbl = (short *) malloc(zoom_points * sizeof(short));
1218  memset(min_av96_zoom_point_tbl, 0, zoom_points * sizeof(short));
1219  }
1220  else {
1221  return;
1222  }
1223  } else min_av96_zoom_point = min_av96_zoom_point_tbl[zoom_point];
1224 
1225  if (min_av96_zoom_point==0 && shooting_in_progress()) {
1226  get_property_case(PROPCASE_MIN_AV, &min_av96, sizeof(min_av96));
1227  min_av96_zoom_point_tbl[zoom_point] = min_av96;
1228  }
1229 
1230  if ((camera_info.state.mode_shooting==MODE_M || camera_info.state.mode_shooting==MODE_AV) && (av96>0) && !f_focus_ok) {
1231  if (av96 < min_av96_zoom_point) av96 = min_av96_zoom_point;
1232  }
1233  else av96 = (abs(curr_av96-prop_av96)<2)?prop_av96:curr_av96;
1234 
1235  av_1e3 = shooting_get_aperture_from_av96(av96);
1238 
1239  if (camera_info.dof_values.aperture_value!=av_1e3 || camera_info.dof_values.focal_length!=fl || (hyp_1e3<0)) {
1240  //calc new hyperfocal distance and min stack distance
1241  f_hyp_calc = 1;
1242  hyp_1e3 = -1;
1243  hyp = -1;
1246  hyp_1e3 = shooting_get_hyperfocal_distance_1e3_f(av_1e3, fl);
1247  if (hyp_1e3>0) {
1248  hyp = (hyp_1e3+500)/1000;
1250  v = ((hyp_1e3 - fl)/250 + 2 + 1)/2;
1251  if (v>0) {
1252  int m = ((fl*((fl - hyp_1e3)/1000 - 1)/500)/v + 1)/2;
1253  int m2 = (int)((((double)hyp*(2*fl - hyp_1e3)/1000))/v + 0.5);
1255  }
1256  }
1257  }
1258 
1259  if ((camera_info.dof_values.subject_distance!=dist || (camera_info.dof_values.hyperfocal_distance_1e3!=hyp_1e3)) && (hyp_1e3>0)) {
1260  //calc new NEAR, FAR, DOF values
1261  f_dist_calc = 1;
1266  if ((av_1e3>0) && (fl>0) && (dist>0) && (shooting_is_infinity_distance()==0) && (hyp_1e3>0)) {
1267  double m = ((double)(hyp_1e3 - fl)/1000 * dist) + 0.5;
1270  } else {
1271  int v = ((((hyp_1e3 - 2*fl + 1000*dist)/500) + 1)/2);
1272  if (v>0) camera_info.dof_values.near_limit = (int)(m/v);
1273  }
1274  int v = ((((hyp_1e3 - 1000*dist)/500) + 1)/2);
1275  if (v>0) camera_info.dof_values.far_limit = (int)(m/v);
1278  }
1279  }
1280  // if at infinity then set near to hyperfocal value
1281  // note focus beyond infinity is not distinguished from infinity
1284  }
1285  }
1288  f_focus_ok = (f_focus_ok && shooting_get_focus_ok());
1291  return;
1292 }
void shooting_update_state ( void  )

Definiert in Zeile 71 der Datei shooting.c.

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

Definiert in Zeile 1431 der Datei shooting.c.

1432 {
1433 #if CAM_CHDK_HAS_EXT_VIDEO_MENU
1434  int m[]={1,2,3,4,5,6,7,8,10,12}; // m[v]/4 = bitrate*1x
1435  if (v>=(int)((sizeof(m)/sizeof(m[0]))))
1436  v=(sizeof(m)/sizeof(m[0]))-1;
1437  change_video_tables(m[v],4);
1438 #else
1439  (void)v;
1440 #endif
1441 }
void unlock_optical_zoom ( void  )

Definiert in Zeile 1465 der Datei shooting.c.

1466 {
1467 #if CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
1468  extern void UnsetZoomForMovie();
1471 #endif
1472 
1473 #if CAM_EV_IN_VIDEO
1474  set_ev_video_avail(0);
1475 #endif
1476 }

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 17 der Datei shooting.c.

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

Definiert in Zeile 1505 der Datei shooting.c.

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

Definiert in Zeile 1499 der Datei shooting.c.

Definiert in Zeile 1496 der Datei shooting.c.

short canon_iso_base =0
static

Definiert in Zeile 387 der Datei shooting.c.

short canon_sv96_base =0
static

Definiert in Zeile 388 der Datei shooting.c.

volatile long focus_busy
int focus_interlock_bypass = 0
static

Definiert in Zeile 1306 der Datei shooting.c.

const double inv_log_2 = 1.44269504088906
static

Definiert in Zeile 58 der Datei shooting.c.

int iso_override_mode_save = 0
static

Definiert in Zeile 52 der Datei shooting.c.

const unsigned int ISO_SIZE

Definiert in Zeile 18 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 1088 der Datei shooting.c.

short* min_av96_zoom_point_tbl = NULL
static

Definiert in Zeile 35 der Datei shooting.c.

const CapturemodeMap modemap[]

Definiert in Zeile 82 der Datei shooting.c.

const unsigned int MODESCNT

Definiert in Zeile 19 der Datei shooting.c.

int movie_status

Definiert in Zeile 72 der Datei lib.c.

const unsigned int param_file_counter

Definiert in Zeile 22 der Datei shooting.c.

PHOTO_PARAM photo_param_put_off
static

Definiert in Zeile 48 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 16 der Datei shooting.c.