CHDK_DE Vorschauversion  Trunk Rev. 5218
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
autoiso.h-Dateireferenz
+ Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Funktionen

void shooting_set_autoiso (int iso_mode)
 
int live_histogram_read_y (unsigned short *buf)
 

Dokumentation der Funktionen

int live_histogram_read_y ( unsigned short *  buf)

Definiert in Zeile 39 der Datei autoiso.c.

40 {
41  int yscale = vid_get_viewport_yscale(); // Y scale factor (2 for 480 line high lv buffer)
42 #ifdef THUMB_FW
43  int vp_width = vid_get_viewport_width_proper() * 2; // X bytes per row
44 #else
45  int vp_width = vid_get_viewport_width_proper() * 6 / 4; // X bytes per row
46 #endif
47  int vp_height = vid_get_viewport_height_proper() / yscale; // Number of rows to process (every second row if 480 high lv buffer)
48 
49  int total = (vp_width * vp_height) / HISTO_STEP_SIZE;
50 
51  unsigned char *img = vid_get_viewport_active_buffer();
52  if (img)
53  {
54  if (h == 0) h = live_histogram_proc;
55  memset(h, 0, sizeof(unsigned short)*256);
56 
57  int vp_offset = vid_get_viewport_byte_width() * yscale; // Bytes length of each row (or double row)
58  img += vid_get_viewport_image_offset() + 1; // Skip border and move to 1st Y component in each block
59 
60  int x, y;
61  for (y=0; y<vp_height; y+=1, img+=vp_offset)
62  {
63  for (x=HISTO_STEP_SIZE/2; x<vp_width; x+=HISTO_STEP_SIZE)
64  {
65  h[img[x]] += 1;
66 // img[x] = img[x+2] = 255; // Change sampled values on screen for debugging
67  }
68  }
69  }
70 
71  return total;
72 }
void shooting_set_autoiso ( int  iso_mode)

Definiert in Zeile 122 der Datei autoiso.c.

123 {
124  short max_iso;
125 
126  if (iso_mode<=0)
128 
129  switch (iso_mode)
130  {
131  case -1: // ISO HI
132  //max_iso = conf.autoiso_max_iso_hi*10;
133  max_iso = conf.autoiso_max_iso_hi_real;
134  break;
135  case 0: // ISO AUTO
136  //max_iso = conf.autoiso_max_iso_auto*10;
138  break;
139  default:
140  return;
141  }
142 
143  // TODO also long shutter ?
145  return; //Only operate outside of M and Tv
146 
147  int ev_overexp = 0;
148  if (conf.overexp_ev_enum)
149  {
150  // No shoot_histogram exist here because no future shot exist yet :)
152 
153  // step 32 is 1/3ev for tv96
155  ev_overexp = conf.overexp_ev_enum << 5;
156  }
157 
158  float current_shutter = shooting_get_shutter_speed_from_tv96(shooting_get_tv96());
159 
160  short current_iso = shooting_get_iso_real();
161 
162  short min_shutter = shutter1_values[conf.autoiso_shutter_enum];
163  if (min_shutter == 0)
164  {
165  short IS_factor = (shooting_get_is_mode()<=1)?conf.autoiso_is_factor:1;
166  min_shutter = get_focal_length(lens_get_zoom_point())*conf.autoiso_user_factor / (IS_factor*1000);
167  //min_shutter is NOT 1/Xs but optimized for the calculation.
169  shooting_calc_autoiso_coef( min_shutter );
170  }
171 
172  short target_iso = current_iso * min_shutter * current_shutter;
173  short min_iso = conf.autoiso_min_iso_real;
174 
175  if (target_iso > max_iso)
176  {
177  ev_overexp=0;
178 
179  // AutoISO2 if
180  // it is turned on (C2!=0.0)
181  // and it has valid iso2/shutter2 ( C2<0)
182  // and non-IsoHI mode
183  if ( !iso_mode && conf.autoiso2_coef < 0.0 )
184  {
185  target_iso = (max_iso - min_shutter*conf.autoiso2_coef) / ( 1.0 - conf.autoiso2_coef / (current_shutter * current_iso) );
186  if ( target_iso > conf.autoiso2_max_iso_auto_real )
187  target_iso = conf.autoiso2_max_iso_auto_real;
188  }
189  else
190  {
191  target_iso = max_iso;
192  }
193  }
194  else if (target_iso < min_iso)
195  {
196  target_iso = min_iso;
197  }
198 
199  float target_shutter = current_shutter * current_iso / target_iso;
200 
201  if (target_shutter > 0)
203 
204  shooting_set_iso_real(target_iso, SET_NOW);
205 }