CHDK_DE Vorschauversion  Trunk Rev. 6014
 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 36 der Datei autoiso.c.

37 {
38 #ifdef THUMB_FW
39  int vp_width = vid_get_viewport_width_proper() * 2; // X bytes per row
40 #else
41  int vp_width = vid_get_viewport_width_proper() * 6 / 4; // X bytes per row
42 #endif
43 
44  int yscale = vid_get_viewport_yscale(); // Y scale factor (2 for 480 line high lv buffer on pre-d6)
45  int vp_height_full = vid_get_viewport_height_proper();
46  // for large resolutions, increase yscale to avoid overflow
47  if(vp_height_full > 480) {
48  // minimum 2
49  yscale = vp_height_full/240;
50  }
51 
52  int vp_height = vp_height_full / yscale; // Number of rows to process
53 
54  // account for cases where step does not exactly divide width
55  int total = ((vp_width + HISTO_STEP_SIZE/2)/HISTO_STEP_SIZE) * vp_height;
56 
57  memset(h, 0, sizeof(unsigned short)*256);
58 
59  unsigned char *img = vid_get_viewport_active_buffer();
60  if (img)
61  {
62  int vp_offset = vid_get_viewport_byte_width() * yscale; // Bytes length of each row (or double row)
63  img += vid_get_viewport_image_offset() + 1; // Skip border and move to 1st Y component in each block
64 
65  int x, y;
66  for (y=0; y<vp_height; y+=1, img+=vp_offset)
67  {
68  for (x=HISTO_STEP_SIZE/2; x<vp_width; x+=HISTO_STEP_SIZE)
69  {
70  h[img[x]] += 1;
71 // img[x] = img[x+2] = 255; // Change sampled values on screen for debugging
72  }
73  }
74  } else {
75  // if no live buffer, act as if all black
76  // should be rare, generally only happens in playback with video selected
77  h[0] = total;
78  }
79 
80  return total;
81 }
void shooting_set_autoiso ( int  iso_mode)

Definiert in Zeile 131 der Datei autoiso.c.

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