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

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