Changeset 1739 for branches/release-1_0/platform/sx210is/main.c
- Timestamp:
- 03/17/12 02:32:01 (15 months ago)
- File:
-
- 1 edited
-
branches/release-1_0/platform/sx210is/main.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-1_0/platform/sx210is/main.c
r1738 r1739 33 33 34 34 //zoom position is get_parameter_data(87) 35 static const struct {36 int zp, fl;37 } fl_tbl[] = {38 { 0, 5000},39 { 16, 6800},40 { 32, 9100},41 { 62, 16200},42 { 78, 22300},43 { 102, 35900},44 { 125, 70000},45 };46 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))47 35 36 // Focus length table in firmware @ 0xfffea1cc 37 #define NUM_FL 126 // 0 - 125, entries in firmware (3 words each entry, first is FL) 38 extern int focus_len_table[NUM_FL*3]; 48 39 49 40 // Focal length range is 5.0 - 70,0 mm, 27.3 - 392 in 35-mm equivalent. … … 53 44 // divide by 10 to avoid overflow in get_effective_focal_length() 54 45 #define CF_EFL 5670 55 const int zoom_points = 126;46 const int zoom_points = NUM_FL; 56 47 57 48 int get_effective_focal_length(int zp) { … … 60 51 61 52 int get_focal_length(int zp) { 62 int i; 63 64 if (zp<fl_tbl[0].zp) 65 return fl_tbl[0].fl; 66 else if (zp>fl_tbl[NUM_FL-1].zp) 67 return fl_tbl[NUM_FL-1].fl; 68 else 69 for (i=1; i<NUM_FL; ++i) { 70 if (zp==fl_tbl[i-1].zp) 71 return fl_tbl[i-1].fl; 72 else if (zp==fl_tbl[i].zp) 73 return fl_tbl[i].fl; 74 else if (zp<fl_tbl[i].zp) 75 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp); 76 } 77 return fl_tbl[NUM_FL-1].fl; 53 if (zp < 0) zp = 0; 54 else if (zp >= NUM_FL) zp = NUM_FL-1; 55 return focus_len_table[zp*3]; 78 56 } 79 57 80 58 int get_zoom_x(int zp) { 81 return get_focal_length(zp)*10/f l_tbl[0].fl;59 return get_focal_length(zp)*10/focus_len_table[0]; 82 60 } 83 61
Note: See TracChangeset
for help on using the changeset viewer.