root/include/camera_info.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef CAMERA_INFO_H
   2 #define CAMERA_INFO_H
   3 
   4 // CHDK camera info interface
   5 
   6 // Note: used in modules and platform independent code. 
   7 // Do not add platform dependent stuff in here (#ifdef/#endif compile options or camera dependent values)
   8 
   9 //==========================================================
  10 
  11 #include "stdlib.h"
  12 
  13 //==========================================================
  14 
  15 // For Depth of Field, and Hyperfocal calculations
  16 typedef struct
  17 {
  18     short hyperfocal_valid;
  19     short distance_valid;
  20     int   hyperfocal_distance_1e3;
  21     int   aperture_value;
  22     int   focal_length;
  23     int   subject_distance;
  24     int   near_limit;
  25     int   far_limit;
  26     int   hyperfocal_distance;
  27     int   depth_of_field;
  28     int   min_stack_distance;
  29 } DOF_TYPE;
  30 
  31 //==========================================================
  32 // Data Structure to store camera specific information
  33 // Used by modules to ensure module code is platform independent
  34 
  35 // Note: if these structures are changed update the corresponding version
  36 //      _cam_sensor --> CAM_SENSOR_VERSION
  37 //      _cam_screen --> CAM_SCREEN_VERSION
  38 //      _cam_info   --> CAM_INFO_VERSION
  39 #define CAM_SCREEN_VERSION      {2,0}       // Version for camera_screen
  40 #define CAM_SENSOR_VERSION      {1,0}       // Version for camera_sensor
  41 #define CAM_INFO_VERSION        {1,0}       // Version for camera_info
  42 
  43 typedef struct
  44 {
  45     int bits_per_pixel;
  46     int black_level;
  47     int white_level;
  48     int raw_rows, raw_rowpix, raw_rowlen, raw_size;
  49     union                       // DNG JPEG info
  50     {
  51         struct
  52         {
  53             int x, y;           // DNG JPEG top left corner
  54             int width, height;  // DNG JPEG size
  55         } jpeg;
  56         struct
  57         {
  58             int origin[2];
  59             int size[2];
  60         } crop;
  61     };
  62     union                       // DNG active sensor area (Y1, X1, Y2, X2)
  63     {
  64         struct
  65         {
  66             int y1, x1, y2, x2;
  67         } active_area;
  68         int dng_active_area[4];
  69     };
  70     int lens_info[8];           // DNG Lens Info
  71     int exposure_bias[2];       // DNG Exposure Bias
  72     int cfa_pattern;
  73     int calibration_illuminant1;
  74     int color_matrix1[18];      // DNG Color Matrix
  75     int calibration_illuminant2;
  76     int color_matrix2[18];      // DNG Color Matrix 2
  77     int has_calibration1;
  78     int camera_calibration1[18];// DNG Camera Calibration Matrix 1
  79     int has_calibration2;
  80     int camera_calibration2[18];// DNG Camera Calibration Matrix 2
  81     int has_forwardmatrix1;
  82     int forward_matrix1[18];    // DNG Camera Forward Matrix 1
  83     int has_forwardmatrix2;
  84     int forward_matrix2[18];    // DNG Camera Forward Matrix 1
  85     int dng_badpixel_value_limit;
  86 } _cam_sensor;
  87 
  88 extern _cam_sensor camera_sensor;
  89 
  90 typedef struct 
  91 {
  92     int     width, height, size;                        // Size of bitmap screen in CHDK co-ordinates
  93     int     physical_width;                             // Actual width of bitmap screen in pixels
  94     int     buffer_width, buffer_height, buffer_size;   // Physical size of bitmap screen
  95     int     disp_left, disp_right, disp_width;          // Usable horizontal size (after excluding touch screen buttons)
  96     int     edge_hmargin;                               // edge overlay top & bottom margin to skip
  97     int     zebra_nobuf, zebra_aspect_adjust;           // zebra feature settings
  98     int     has_variable_aspect;                        // zebra feature settings
  99     int     ts_menu_border;                             // touch screen top & bottom margin to skip for menus (area that is less sensitive)
 100     int     menu_border_width;                          // Width of border on each side of CHDK menu
 101     int     fselect_name_size;                          // file select window file name column width
 102     int     fselect_size_size;                          // file select window file size column width
 103     int     fselect_time_size;                          // file select window file date column width
 104 } _cam_screen;
 105 
 106 extern _cam_screen camera_screen;
 107 
 108 typedef struct
 109 {
 110     unsigned int    tick_count;         // tick count of last call to function
 111     unsigned int    last, min, max, sum, count;
 112 } time_counter;
 113 
 114 typedef struct
 115 {
 116     // Canon PARAMS indexes
 117     struct
 118     {
 119         int camera_name;
 120         int owner_name;
 121         int artist_name;
 122         int copyright;
 123     } params;
 124     // Canon PROPCASE indexes
 125     struct
 126     {
 127         int propset;
 128         int gps;
 129         int orientation_sensor;
 130         int tv;
 131         int av;
 132         int min_av;
 133         int ev_correction_1;
 134         int ev_correction_2;
 135         int flash_mode;
 136         int flash_fire;
 137         int metering_mode;
 138         int wb_adj;
 139         int aspect_ratio;
 140         int shooting;
 141         int resolution;
 142         int quality;
 143         int af_lock;
 144     } props;
 145     int rombaseaddr, maxramaddr, memisosize;
 146     int cam_uncached_bit, exmem;
 147     int text_start, data_start, bss_start, bss_end;     // Link values (used for debug)
 148     int tick_count_offset;      // get_tick_count value at which the clock ticks over 1 second
 149     char* platform;
 150     char* platformsub;
 151     char* chdk_ver;
 152     char* build_number;
 153     char* chdk_dng_ver;
 154     char* build_svnrev;
 155     char* build_date;
 156     char* build_time;
 157     char* os;
 158     int cam_ev_in_video;            // Can CHDK can change exposure in video mode?
 159     int cam_has_nd_filter;
 160     int cam_has_iris_diaphragm;
 161     int cam_has_video_button, cam_has_zoom_lever;
 162     int cam_has_manual_focus;
 163     int cam_has_multipart;
 164     int cam_remote_sync_status_led;
 165     int cam_key_press_delay, cam_key_release_delay;
 166     int cam_af_led;
 167     int circle_of_confusion;
 168     // Miscellaneous variables to record state information
 169     // Used to control communication between various tasks and modules
 170     struct
 171     {
 172         int     edge_state_draw;            // Current state of overlay (Live/Frozen/Pano)
 173         int     is_shutter_half_press;      // State of Shutter Half Press button
 174         int     auto_started;               // Set to 1 if script auto-started
 175         int     user_menu_has_changed;      // not saved to config file, used to tell code that file needs to be saved
 176         int     kbd_last_clicked;           // For scripts
 177         long    kbd_last_clicked_time;      // For scripts
 178         long    kbd_last_checked_time;      // For scripts
 179         long    shutter_open_time;          // For DNG EXIF creation
 180         long    shutter_open_tick_count;    // For DNG EXIF creation
 181         int     state_shooting_progress;    // Holds current state when still image being processed
 182         int     state_kbd_script_run;       // Script execution state
 183         int     osd_title_line;             // Display state of CHDK OSD title line
 184 
 185         int     gui_mode;                   // Current GUI mode (from gui_mode->mode)
 186         int     gui_mode_none;              // Current GUI mode == GUI_MODE_NONE
 187         int     gui_mode_alt;               // Current GUI mode == GUI_MODE_ALT
 188 
 189         int     mode;                       // Camera mode info
 190         int     mode_shooting;              // Camera shooting mode
 191         int     mode_video;                 // Are we in camera video mode
 192         int     mode_rec;                   // Are we in camera record mode (still image)
 193         int     mode_rec_or_review;         // Are we in camera record mode (still image) or review hold & OSD displayed in review hold
 194         int     mode_play;                  // Are we in camera playback mode
 195         int     mode_photo;                 // Are we in camera photo mode (playback or not video and not stitch)
 196                                             //  - why is some functionality disabled in MODE_STITCH; but not MODE_SCN_STITCH (e.g. bracketing) ?????
 197     } state;
 198 
 199     // Performance counters
 200     struct
 201     {
 202         unsigned int    md_detect_tick;     // Tick count of last motion detection
 203         int             md_af_tuning;       // Flag to enable/disable the Motion Detect tuning code using the AF LED
 204         int             af_led_on;          // Counter to time AF led turn on (for AF LED MD tuning)
 205         time_counter    af_led;             // Counters for AF led MD timing
 206         int             md_af_on_flag;      // Flag to turn on AF led after MD detects motion (to calculate delay from detect to capture)
 207         unsigned int    md_af_on_delay;     // How long after MD triggers to wait before turning on AF led
 208         unsigned int    md_af_on_time;      // How long to leave AF led on for
 209     } perf;
 210 
 211     // Depth of Field, Hyperfocal distance, etc
 212     DOF_TYPE dof_values;
 213 
 214 #if defined(OPT_FILEIO_STATS)
 215     // Optional stats from file IO functions (open, close, read, write, etc)
 216     struct
 217     {
 218         int     fileio_semaphore_errors;
 219         int     max_semaphore_timeout;
 220         int     close_badfile_count;
 221         int     write_badfile_count;
 222         int     open_count;
 223         int     close_count;
 224         int     open_fail_count;
 225         int     close_fail_count;
 226     } fileio_stats;
 227 #endif
 228 } _cam_info;
 229 
 230 extern _cam_info camera_info;
 231 
 232 extern void camera_info_init();
 233 
 234 //==========================================================
 235 
 236 #endif /* CAMERA_INFO_H */

/* [<][>][^][v][top][bottom][index][help] */