source: trunk/include/camera.h @ 1086

Revision 1086, 133.6 KB checked in by reyalP, 2 years ago (diff)

sx30 and g12 updates from philmoz in http://chdk.setepontos.com/index.php?topic=650.msg62654#msg62654

  • Fixes startup crash (hopefully) by using different 'Open' firmware function (G12 & SX30). (see
  • Added ND filter to G12 (from CHDK-DE).
  • Faster motion detect by implementing vid_get_viewport_live_fb (G12 & SX30).
  • Fixed bracketing in continuous shooting mode when timer enabled.

generic MD optimization will be in a separate commit

  • Property svn:eol-style set to native
Line 
1#ifndef CAMERA_H
2#define CAMERA_H
3
4//==========================================================
5// Camera-dependent settings
6//==========================================================
7
8//----------------------------------------------------------
9// Default values
10//----------------------------------------------------------
11    #undef  CAM_RAW_ROWPIX                          // Number of pixels in RAW row
12    #undef  CAM_RAW_ROWS                            // Number of rows in RAW
13
14    #undef  CAM_DRYOS                               // Camera is DryOS-based
15    #undef  CAM_PROPSET                             // Camera's properties group (the generation)
16
17    #undef  CAM_SWIVEL_SCREEN                       // Camera has rotated LCD screen
18    #define CAM_USE_ZOOM_FOR_MF         1           // Zoom lever can be used for manual focus adjustments
19    #undef  CAM_ADJUSTABLE_ALT_BUTTON               // ALT-button can be set from menu
20    #define CAM_REMOTE                  1           // Camera supports USB-remote
21    #define CAM_SYNCH                   1           // Camera supports SDM precision synch
22    #undef  CAM_MULTIPART                           // Camera supports SD-card multipartitioning
23    #define CAM_HAS_ZOOM_LEVER          1           // Camera has dedicated zoom buttons
24    #undef  CAM_DRAW_EXPOSITION                     // Output expo-pair on screen (for cameras which (sometimes) don't do that)
25    #define CAM_HAS_ERASE_BUTTON        1           // Camera has dedicated erase button
26    #define CAM_HAS_IRIS_DIAPHRAGM      1           // Camera has real diaphragm mechanism
27    #undef  CAM_HAS_ND_FILTER                       // Camera has build-in ND filter
28    #define CAM_CAN_SD_OVER_NOT_IN_MF   1           // Camera allows subject distance (focus) override when not in manual focus mode
29    #define CAM_CAN_SD_OVERRIDE         1           // Camera allows to do subject distance override
30    #define CAM_HAS_MANUAL_FOCUS        1           // Camera has manual focus mode
31    #define CAM_HAS_USER_TV_MODES       1           // Camera has tv-priority or manual modes with ability to set tv value
32    #undef  CAM_SHOW_OSD_IN_SHOOT_MENU              // On some cameras Canon shoot menu has additional functionality and useful in this case to see CHDK OSD in this mode
33    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO  1 // Camera can unlock optical zoom in video (if it is locked)
34    #undef  CAM_FEATURE_FEATHER                     // Cameras with "feather" or touch wheel.
35    #define CAM_HAS_IS                  1           // Camera has image stabilizer
36    #undef  CAM_HAS_JOGDIAL                         // Camera has a "jog dial"
37
38    #undef  CAM_CONSOLE_LOG_ENABLED                 // Development: internal camera stdout -> A/stdout.txt
39    #define CAM_CHDK_HAS_EXT_VIDEO_MENU 1           // In CHDK for this camera realized adjustable video compression
40    #undef  CAM_CAN_MUTE_MICROPHONE                 // Camera has function to mute microphone
41
42    #define CAM_EMUL_KEYPRESS_DELAY     40          // Delay to interpret <alt>-button press as longpress
43    #define CAM_EMUL_KEYPRESS_DURATION  5           // Length of keypress emulation
44
45    #define CAM_MENU_BORDERWIDTH        30          // Related to screen layout somehow.
46                                                    // TODO someone explain what this does, probably doesn't really belong here
47
48    #undef  CAM_AF_SCAN_DURING_VIDEO_RECORD         // CHDK can make single AF scan during video record
49    #undef  CAM_HAS_VIDEO_BUTTON                    // Camera can take stills in video mode, and vice versa
50    #undef  CAM_EV_IN_VIDEO                         // CHDK can change exposure in video mode
51    #define CAM_VIDEO_CONTROL           1           // pause / unpause video recordings
52    #undef  CAM_VIDEO_QUALITY_ONLY                  // Override Video Bitrate is not supported
53
54    #define ZOOM_OVERRIDE               0           // Shall zoom-override be used? default 0 becoz not implemented right now
55
56    #define DNG_SUPPORT                 1           // Camera supports DNG format for saving of RAW images
57
58    #undef  CAM_REAR_CURTAIN                        // Camera do not have front/rear curtain flash sync in menu
59    #undef  CAM_BRACKETING                          // Cameras that have bracketing (focus & ev) in original firmware already, most likely s- & g-series (propcase for digic III not found yet!)
60    #undef  CAM_EXT_TV_RANGE                        // CHDK can make exposure time longer than 64s
61    #undef  CAM_CHDK_PTP                            // include CHDK PTP support
62
63    #define CAM_UNCACHED_BIT            0x10000000  // bit indicating the uncached memory
64
65    #define CAM_MAKE                    "Canon"
66    #define CAM_SENSOR_BITS_PER_PIXEL   10          // Bits per pixel. 10 is standard, 12 is supported except for curves
67    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
68    #define CAM_BLACK_LEVEL             31
69
70    #define CAM_BITMAP_PALETTE          1           // which color set is used for this camera
71
72    #undef CAM_HAS_VARIABLE_ASPECT                  // can switch between 16:9 and 4:3
73    #define DEFAULT_RAW_EXT             1           // extension to use for raw (see raw_exts in conf.c)
74
75    // by nandoide sept-2009
76    // zebra adjust buffer height: show use at sx200is: needed for save memory space
77    #define ZEBRA_HMARGIN0              0
78
79    // aspect corrections
80    #define CAM_USES_ASPECT_CORRECTION  0           // if true, camera uses a modified graphics primitives to draw with exact display aspect-ratio.
81                                                    // Could slow the graphics output (but not perceived on sx200is), but adds rectangle drawing optimizations to compensate.
82                                                    // To extend to other cameras see sx200is camera.h comments in  and comments on core gui_draw.c
83    #define CAM_USES_ASPECT_YCORRECTION 0
84
85    // menu, alt (default)
86    #define ASPECT_XCORRECTION(x)  ( ((x)<<1) )     // see comments on 200is
87    #define ASPECT_YCORRECTION(y)  ( (y) )          // no correction the same for coordinate y. I think there are no cameras actually needing both corrections.
88    // viewport, defaults used if there is no aspect correction
89    #define ASPECT_VIEWPORT_XCORRECTION(x) ( (x) )  // see comments on 200is
90    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )  // no correction
91
92    #define EDGE_HMARGIN                0           // define sup and inf screen margins on edge overlay without overlay.  Necessary to save memory buffer space. sx200is needs values other than 0
93    // end of section by nandoid
94
95    #undef CAM_QUALITY_OVERRIDE                     // camera may need shooting quality override (sx200is lacks SuperFine quality)
96
97    #undef CAM_ZEBRA_ASPECT_ADJUST                  // zebra needs to account for real bitmap size being different from what lib.c reports
98                                                    // also used by some cameras with normal bitmap layouts for memory saving ?
99    #undef CAM_ZEBRA_NOBUF                          // zebra draws directly on bitmap buffer. Requires above as well
100
101    #undef CAM_DATE_FOLDER_NAMING                   // set if camera uses date based folder naming (Option "Create Folder" in Canon Menu) and get_target_dir_name is implemented
102
103//----------------------------------------------------------
104// Override Default values for Camera if necessary
105//----------------------------------------------------------
106
107//==========================================================
108// G-series
109//==========================================================
110#if   defined (CAMERA_g7)
111    #define CAM_PROPSET                 1
112
113    #define CAM_RAW_ROWPIX              3736   // for 10 MP
114    #define CAM_RAW_ROWS                2772   // for 10 MP
115
116    #undef  CAM_USE_ZOOM_FOR_MF
117    #define CAM_ADJUSTABLE_ALT_BUTTON   1
118    #define CAM_MULTIPART               1
119    #define CAM_HAS_ND_FILTER           1
120    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
121    #define CAM_HAS_JOGDIAL             1
122    // pattern
123    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
124    // color
125    #define CAM_COLORMATRIX1                              \
126      575419, 1000000,-185557, 1000000, -77898,  1000000, \
127     -213702, 1000000, 733569, 1000000,   81514, 1000000, \
128      -24604, 1000000, 131906, 1000000,  280378, 1000000
129
130    #define cam_CalibrationIlluminant1 1 // Daylight
131    // cropping
132    #define CAM_JPEG_WIDTH  3648
133    #define CAM_JPEG_HEIGHT 2736
134    #define CAM_ACTIVE_AREA_X1 14
135    #define CAM_ACTIVE_AREA_Y1 8
136    #define CAM_ACTIVE_AREA_X2 3682
137    #define CAM_ACTIVE_AREA_Y2 2764
138    // camera name
139    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
140    #define CAM_BRACKETING              1   
141    #define DNG_EXT_FROM ".DPS"
142//----------------------------------------------------------
143
144#elif defined (CAMERA_g9)
145        #define CAM_PROPSET                                                     2
146        #define CAM_DRYOS                                                       1
147
148        #define CAM_RAW_ROWPIX                                          4104    // for 12 MP
149        #define CAM_RAW_ROWS                                            3048    // for 12 MP
150        #define CAM_HAS_ND_FILTER                                       1
151        #define CAM_ADJUSTABLE_ALT_BUTTON                       1
152        #undef  CAM_EMUL_KEYPRESS_DURATION
153        #define CAM_EMUL_KEYPRESS_DURATION                      10
154        #define CAM_AF_SCAN_DURING_VIDEO_RECORD         1
155        #define CAM_HAS_JOGDIAL                                         1
156        // #define CAM_CONSOLE_LOG_ENABLED                      1
157        #define CAM_BRACKETING                                          1
158        #define CAM_MULTIPART                                           1
159        #define CAM_EXT_TV_RANGE                                        1
160
161        // camera name
162        #define PARAM_CAMERA_NAME                                       4       // parameter number for GetParameterData
163
164        // pattern
165        #define cam_CFAPattern                                          0x02010100      // Red  Green  Green  Blue
166        // color (alternativ: http://lclevy.free.fr/cr2/)
167        #define CAM_COLORMATRIX1 \
168        1679727, 1000000,  422803, 1000000,  803343, 1000000, \
169         220204, 1000000, 1784845, 1000000,  -63290, 1000000, \
170        -282882, 1000000, -475034, 1000000, 4502592, 1000000
171
172        #define cam_CalibrationIlluminant1                      1       // Daylight
173
174        // cropping
175        #define CAM_JPEG_WIDTH                                          4000
176        #define CAM_JPEG_HEIGHT                                         3000
177        #define CAM_ACTIVE_AREA_X1                                      52
178        #define CAM_ACTIVE_AREA_Y1                                      14
179        #define CAM_ACTIVE_AREA_X2                                      4076
180        #define CAM_ACTIVE_AREA_Y2                                      3030
181//----------------------------------------------------------
182
183
184//==========================================================
185// A-series
186//==========================================================
187#elif defined (CAMERA_a430)
188        #define CAM_PROPSET                                             1
189
190        #define CAM_RAW_ROWPIX                                  2392  // for 4 MP 1/3" sensor size
191        #define CAM_RAW_ROWS                                    1752  // for 4 MP 1/3" sensor size
192
193        #undef  CAM_USE_ZOOM_FOR_MF
194        #undef  CAM_HAS_ZOOM_LEVER
195        #define CAM_DRAW_EXPOSITION                             1
196        #undef  CAM_HAS_ERASE_BUTTON
197        #undef  CAM_HAS_IRIS_DIAPHRAGM
198        #define CAM_HAS_ND_FILTER                               1
199        #undef  CAM_HAS_MANUAL_FOCUS
200        #undef  CAM_HAS_USER_TV_MODES
201        #define CAM_SHOW_OSD_IN_SHOOT_MENU              1
202        #undef  CAM_HAS_IS
203        #define CAM_CAN_MUTE_MICROPHONE                 1
204        #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
205        #define CAM_EV_IN_VIDEO                                 1
206        // pattern
207        #define cam_CFAPattern 0x01000201  // Green Blue Red Green
208        // color
209        #define CAM_COLORMATRIX1                                \
210      479627,  1000000, -156240, 1000000,  -84926, 1000000, \
211     -215238,  1000000,  534902, 1000000,   60219, 1000000, \
212      -96906,  1000000,  148194, 1000000,  191583, 1000000
213
214        #define CAM_CONSOLE_LOG_ENABLED                 1
215        #define cam_CalibrationIlluminant1              1 // Daylight
216        // cropping
217        #define CAM_JPEG_WIDTH                  2272
218        #define CAM_JPEG_HEIGHT                 1704
219        #define CAM_ACTIVE_AREA_X1              0
220        #define CAM_ACTIVE_AREA_Y1              8
221        #define CAM_ACTIVE_AREA_X2              2336
222        #define CAM_ACTIVE_AREA_Y2              1748
223        // camera name
224        #define PARAM_CAMERA_NAME               3 // parameter number for GetParameterData
225        #define CAM_BRACKETING                  1
226//      #define CAM_MULTIPART                   1
227//----------------------------------------------------------
228
229#elif defined (CAMERA_a450)
230        #define CAM_PROPSET                                             2
231
232        #define CAM_RAW_ROWPIX                                  2664   // for 5 MP 1/3" sensor size
233        #define CAM_RAW_ROWS                                    1968   // for 5 MP 1/3" sensor size
234
235        #undef  CAM_USE_ZOOM_FOR_MF
236        #undef  CAM_HAS_ZOOM_LEVER
237        #define CAM_DRAW_EXPOSITION                             1
238        #undef  CAM_HAS_ERASE_BUTTON
239        #undef  CAM_HAS_IRIS_DIAPHRAGM
240        #define CAM_HAS_ND_FILTER                               1
241        #undef  CAM_HAS_MANUAL_FOCUS
242        #undef  CAM_HAS_USER_TV_MODES
243        #define CAM_SHOW_OSD_IN_SHOOT_MENU              1
244        #undef  CAM_HAS_IS
245        #define CAM_CAN_MUTE_MICROPHONE                 1
246        #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
247        #define CAM_EV_IN_VIDEO                                 1
248        // pattern
249        #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
250        // color
251        #define CAM_COLORMATRIX1                               \
252      652279,  1000000, -199279, 1000000, -101833, 1000000, \
253     -159819,  1000000,  619308, 1000000,   78172, 1000000, \
254      -58827,  1000000,  150963, 1000000,  264216, 1000000
255
256        #define cam_CalibrationIlluminant1              1 // Daylight
257        // cropping
258        #define CAM_JPEG_WIDTH                  2592
259        #define CAM_JPEG_HEIGHT                 1944
260        #define CAM_ACTIVE_AREA_X1              6
261        #define CAM_ACTIVE_AREA_Y1              6
262        #define CAM_ACTIVE_AREA_X2              2618
263        #define CAM_ACTIVE_AREA_Y2              1962
264        // camera name
265        #define PARAM_CAMERA_NAME               4 // parameter number for GetParameterData
266//----------------------------------------------------------
267
268#elif defined (CAMERA_a460)
269    #define CAM_PROPSET                 2
270
271    #define CAM_RAW_ROWPIX              2664   // for 5 MP 1/3" sensor size
272    #define CAM_RAW_ROWS                1968   // for 5 MP 1/3" sensor size
273
274    #undef  CAM_USE_ZOOM_FOR_MF
275    #undef  CAM_HAS_ZOOM_LEVER
276    #define CAM_DRAW_EXPOSITION         1
277    #undef  CAM_HAS_ERASE_BUTTON
278    #undef  CAM_HAS_IRIS_DIAPHRAGM
279    #define CAM_HAS_ND_FILTER           1
280    #undef  CAM_HAS_MANUAL_FOCUS
281    #undef  CAM_HAS_USER_TV_MODES
282    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
283    #undef  CAM_HAS_IS
284    #define CAM_CAN_MUTE_MICROPHONE     1
285    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
286    #define CAM_EV_IN_VIDEO             1
287    // pattern
288    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
289    // color
290    #define CAM_COLORMATRIX1                               \
291      649324,  1000000,-233893, 1000000, -88521, 1000000,  \
292     -158955,  1000000, 593407, 1000000,  69775, 1000000,  \
293      -44551,  1000000, 136891, 1000000, 254362, 1000000   
294
295    #define cam_CalibrationIlluminant1 1 // Daylight
296    // cropping
297    #define CAM_JPEG_WIDTH  2592
298    #define CAM_JPEG_HEIGHT 1944
299    #define CAM_ACTIVE_AREA_X1 6
300    #define CAM_ACTIVE_AREA_Y1 6
301    #define CAM_ACTIVE_AREA_X2 2618
302    #define CAM_ACTIVE_AREA_Y2 1962
303    // camera name
304    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
305    #define DNG_EXT_FROM ".DPS"
306//----------------------------------------------------------
307
308#elif defined (CAMERA_a470)
309        #define CAM_PROPSET                 2
310        #define CAM_DRYOS                   1
311
312        #define CAM_RAW_ROWPIX              3152   // for 7 MP
313        #define CAM_RAW_ROWS               2340   // for 7 MP
314
315        #undef  CAM_USE_ZOOM_FOR_MF
316        #undef  CAM_HAS_ZOOM_LEVER
317        #undef  CAM_HAS_ERASE_BUTTON
318        #undef  CAM_HAS_IRIS_DIAPHRAGM
319        #define CAM_HAS_ND_FILTER           1
320        #undef  CAM_HAS_MANUAL_FOCUS
321        #undef  CAM_HAS_USER_TV_MODES
322        #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
323        #undef  CAM_HAS_IS
324        #define CAM_CAN_MUTE_MICROPHONE     1
325        #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
326        #define CAM_EV_IN_VIDEO             1
327        #define CAM_MULTIPART               1
328       
329        // pattern
330        #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
331        // color
332        #define CAM_COLORMATRIX1                             \
333        673251,  1000000,-200684, 1000000, -98680, 1000000,  \
334        -163638, 1000000, 651247, 1000000,  74004, 1000000,  \
335        14221,   1000000, 52979,  1000000, 265291, 1000000   
336        #define cam_CalibrationIlluminant1 1 // Daylight
337        // cropping
338        #define CAM_JPEG_WIDTH  3096
339        #define CAM_JPEG_HEIGHT 2324
340        #define CAM_ACTIVE_AREA_X1 12
341        #define CAM_ACTIVE_AREA_Y1 8
342        #define CAM_ACTIVE_AREA_X2 3108
343        #define CAM_ACTIVE_AREA_Y2 2332
344        // camera name
345        #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
346        //#define DNG_EXT_FROM ".DPS"   
347//----------------------------------------------------------
348
349#elif defined (CAMERA_a480)
350    #define CAM_PROPSET                 2
351    #define CAM_DRYOS                   1
352
353    #define CAM_RAW_ROWPIX              3720   
354    #define CAM_RAW_ROWS                2772   
355
356    #undef  CAM_USE_ZOOM_FOR_MF
357    #undef  CAM_HAS_ERASE_BUTTON
358    #undef  CAM_HAS_IRIS_DIAPHRAGM
359    #define CAM_HAS_ND_FILTER           1
360    #undef  CAM_HAS_MANUAL_FOCUS
361    #undef  CAM_HAS_USER_TV_MODES
362    #undef  CAM_HAS_IS
363    #define CAM_MULTIPART               1
364    #undef  CAM_VIDEO_CONTROL
365    #define CAM_REAR_CURTAIN            1
366    #undef  DEFAULT_RAW_EXT
367    #define DEFAULT_RAW_EXT             2   // use .CR2
368    #define CAM_EXT_TV_RANGE            1
369    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
370    #define CAM_CAN_MUTE_MICROPHONE     1
371    #define CAM_EV_IN_VIDEO             1
372
373    // pattern
374    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
375    // color
376
377    #define CAM_COLORMATRIX1                               \
378      827547, 1000000, -290458, 1000000, -126086, 1000000, \
379     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
380      5181,   1000000, 48183,   1000000, 245014,  1000000
381
382    #define cam_CalibrationIlluminant1 1 // Daylight
383    // cropping
384    #define CAM_JPEG_WIDTH  3648
385    #define CAM_JPEG_HEIGHT 2736
386    #define CAM_ACTIVE_AREA_X1 6
387    #define CAM_ACTIVE_AREA_Y1 12
388    #define CAM_ACTIVE_AREA_X2 3690
389    #define CAM_ACTIVE_AREA_Y2 2772
390
391    // camera name
392    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
393    #undef  CAM_SENSOR_BITS_PER_PIXEL
394    #undef  CAM_WHITE_LEVEL
395    #undef  CAM_BLACK_LEVEL
396    #define CAM_SENSOR_BITS_PER_PIXEL   12
397    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
398    #define CAM_BLACK_LEVEL             127
399//----------------------------------------------------------
400
401#elif defined (CAMERA_a530)
402    #define CAM_PROPSET                 1
403
404//  2672x1968 image - like most other 5m sensors
405    #define CAM_RAW_ROWPIX              2672   // for 5 MP
406    #define CAM_RAW_ROWS                1968   // for 5 MP
407//  2672x1992 image - eventually probably real sensor size
408//  #define CAM_RAW_ROWPIX              2672   // for 5 MP
409//  #define CAM_RAW_ROWS                1992   // for 5 MP
410
411    #undef  CAM_USE_ZOOM_FOR_MF
412    #define CAM_HAS_ERASE_BUTTON        1
413    #undef  CAM_HAS_IRIS_DIAPHRAGM
414    #define CAM_HAS_ND_FILTER           1
415    #define CAM_HAS_MANUAL_FOCUS        1
416    #define CAM_DRAW_EXPOSITION         1
417    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
418    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
419    #undef  CAM_HAS_IS
420    #define CAM_CAN_MUTE_MICROPHONE     1
421    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
422    #define CAM_EV_IN_VIDEO             1
423    // pattern
424    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
425    // color
426    #define CAM_COLORMATRIX1                               \
427      725264,  1000000,-240542, 1000000, -122310, 1000000, \
428     -210248,  1000000, 656077, 1000000,  52390,  1000000, \
429      -11282,  1000000, 70400,  1000000,  300712, 1000000
430
431    #define cam_CalibrationIlluminant1 1 // Daylight
432    // cropping
433    #define CAM_JPEG_WIDTH  2592
434    #define CAM_JPEG_HEIGHT 1944
435    #define CAM_ACTIVE_AREA_X1 12
436    #define CAM_ACTIVE_AREA_Y1 20
437    #define CAM_ACTIVE_AREA_X2 2628
438    #define CAM_ACTIVE_AREA_Y2 1968
439    // camera name
440    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
441    #define DNG_EXT_FROM ".DPS"
442
443    #define CAM_EXT_TV_RANGE            1
444//----------------------------------------------------------
445
446#elif defined (CAMERA_a540)
447    #define CAM_PROPSET                 1
448
449    #define CAM_RAW_ROWPIX              2888   // for 6 MP
450    #define CAM_RAW_ROWS                2136   // for 6 MP
451
452    #undef  CAM_USE_ZOOM_FOR_MF
453    #define CAM_HAS_ERASE_BUTTON        1
454    #define CAM_HAS_IRIS_DIAPHRAGM      1
455    #undef  CAM_HAS_ND_FILTER
456    #define CAM_HAS_MANUAL_FOCUS        1
457    #undef  CAM_DRAW_EXPOSITION
458    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
459    #undef  CAM_HAS_IS
460    #define CAM_CAN_MUTE_MICROPHONE     1
461    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
462    #define CAM_EV_IN_VIDEO             1
463    // pattern
464    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
465    // color
466    #define CAM_COLORMATRIX1                               \
467      687147,  1000000,-201964, 1000000, -125024, 1000000, \
468     -148403,  1000000, 566810, 1000000,   45401, 1000000, \
469     -9472,    1000000, 63186,  1000000,  208602, 1000000
470
471    #define cam_CalibrationIlluminant1 1 // Daylight
472    // cropping
473    #define CAM_JPEG_WIDTH  2816
474    #define CAM_JPEG_HEIGHT 2112
475    #define CAM_ACTIVE_AREA_X1 44
476    #define CAM_ACTIVE_AREA_Y1 8
477    #define CAM_ACTIVE_AREA_X2 2884
478    #define CAM_ACTIVE_AREA_Y2 2136
479    // camera name
480    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
481    #define DNG_EXT_FROM ".DPS"
482
483    #define CAM_EXT_TV_RANGE            1
484
485    #define  CAM_CHDK_PTP               1 // include CHDK PTP support
486
487//----------------------------------------------------------
488
489#elif defined (CAMERA_a550)
490    #define CAM_PROPSET                 2
491
492    #define CAM_RAW_ROWPIX              3152   // for 7 MP
493    #define CAM_RAW_ROWS                2340   // for 7 MP
494
495    #undef  CAM_USE_ZOOM_FOR_MF
496    #define CAM_MULTIPART               1
497    #undef  CAM_HAS_ERASE_BUTTON
498    #undef  CAM_HAS_IRIS_DIAPHRAGM
499    #define CAM_HAS_ND_FILTER           1
500    #undef  CAM_HAS_MANUAL_FOCUS
501    #undef  CAM_HAS_USER_TV_MODES
502    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
503    #undef  CAM_HAS_IS
504    #define CAM_CAN_MUTE_MICROPHONE     1
505    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
506    // pattern
507    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
508    // color
509    #define CAM_COLORMATRIX1                               \
510      673251,  1000000,-200684, 1000000, -98680, 1000000,  \
511     -163638,  1000000, 651247, 1000000,  74004, 1000000,  \
512      14221,   1000000, 52979,  1000000, 265291, 1000000
513
514    #define cam_CalibrationIlluminant1 1 // Daylight
515    // cropping
516    #define CAM_JPEG_WIDTH  3072
517    #define CAM_JPEG_HEIGHT 2304
518    #define CAM_ACTIVE_AREA_X1 36
519    #define CAM_ACTIVE_AREA_Y1 12
520    #define CAM_ACTIVE_AREA_X2 3148
521    #define CAM_ACTIVE_AREA_Y2 2340
522    // camera name
523    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
524    #define DNG_EXT_FROM ".DPS"
525
526    #define CAM_EXT_TV_RANGE            1
527//----------------------------------------------------------
528
529#elif defined (CAMERA_a560)
530    #define CAM_PROPSET                 2
531
532    #define CAM_RAW_ROWPIX              3152   // for 7 MP
533    #define CAM_RAW_ROWS                2340   // for 7 MP
534
535    #undef  CAM_USE_ZOOM_FOR_MF
536    #define CAM_MULTIPART               1
537    #undef  CAM_HAS_ERASE_BUTTON
538    #undef  CAM_HAS_IRIS_DIAPHRAGM
539    #define CAM_HAS_ND_FILTER           1
540    #undef  CAM_HAS_MANUAL_FOCUS
541    #undef  CAM_HAS_USER_TV_MODES
542    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
543    #undef  CAM_HAS_IS
544    #define CAM_CAN_MUTE_MICROPHONE     1
545    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
546    // pattern
547    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
548    // color
549    #define CAM_COLORMATRIX1                               \
550      15265, 1, -6193, 1, -1558, 1,                        \
551     -4125,  1, 12116, 1,  2010, 1,                        \
552     -888,   1, 1639,  1,  5220, 1                         
553   
554    #define cam_CalibrationIlluminant1 17 // Standard light A
555    // cropping
556    #define CAM_JPEG_WIDTH  3072
557    #define CAM_JPEG_HEIGHT 2304
558    #define CAM_ACTIVE_AREA_X1 38
559    #define CAM_ACTIVE_AREA_Y1 14
560    #define CAM_ACTIVE_AREA_X2 3146
561    #define CAM_ACTIVE_AREA_Y2 2338
562    // camera name
563    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
564    #define DNG_EXT_FROM ".DPS"
565
566    #define CAM_EXT_TV_RANGE            1
567//----------------------------------------------------------
568
569#elif defined (CAMERA_a570)
570        #define CAM_PROPSET                 2
571
572        #define CAM_RAW_ROWPIX              3152        // for 7 MP
573        #define CAM_RAW_ROWS                2340        // for 7 MP
574        #define CAM_MULTIPART               1
575        #define CAM_CAN_MUTE_MICROPHONE     1
576        #define CAM_ADJUSTABLE_ALT_BUTTON   1
577        #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
578        #define CAM_EV_IN_VIDEO             1
579        #define CAM_REAR_CURTAIN            1
580        // pattern
581        #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
582        // color
583        #define CAM_COLORMATRIX1                            \
584    528283, 1000000,-144259, 1000000, -85966, 1000000,  \
585    -202789, 1000000, 736563, 1000000, 73008, 1000000,  \
586    -27130,  1000000, 107702, 1000000, 264543, 1000000
587
588        #define cam_CalibrationIlluminant1 1 // Daylight
589        // cropping
590        #define CAM_JPEG_WIDTH  3072
591        #define CAM_JPEG_HEIGHT 2304
592        #define CAM_ACTIVE_AREA_X1 38
593        #define CAM_ACTIVE_AREA_Y1 14
594        #define CAM_ACTIVE_AREA_X2 3146
595        #define CAM_ACTIVE_AREA_Y2 2338
596        // camera name
597        #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
598
599        #define DNG_EXT_FROM ".DPS"
600        #define CAM_EXT_TV_RANGE            1
601        #define CAM_CHDK_PTP                1 // include CHDK PTP support
602//----------------------------------------------------------
603
604#elif defined (CAMERA_a590)
605#define CAM_ADJUSTABLE_ALT_BUTTON   1
606#define CAM_PROPSET                 2
607#define CAM_DRYOS                   1
608
609#define CAM_RAW_ROWPIX              3336   // for new 8 MP
610#define CAM_RAW_ROWS                2480   // for new 8 MP
611
612#define CAM_USE_ZOOM_FOR_MF         1
613
614#define CAM_CAN_MUTE_MICROPHONE     1
615#define CAM_HAS_IRIS_DIAPHRAGM      1
616#undef  CAM_HAS_ND_FILTER
617
618#define CAM_HAS_MANUAL_FOCUS        1
619
620#define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
621//#define CAM_EV_IN_VIDEO             1      // not working on 101b!!!
622// pattern
623#define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
624// color                                                     
625#define CAM_COLORMATRIX1                              \
626 726857, 1000000, -176454, 1000000, -124118, 1000000, \
627 -71340, 1000000,  592001, 1000000,   75622, 1000000, \
628  63222, 1000000,   50547, 1000000,  219582, 1000000
629
630#define cam_CalibrationIlluminant1 1 // Daylight
631// cropping
632#define CAM_JPEG_WIDTH  3264
633#define CAM_JPEG_HEIGHT 2448
634#define CAM_ACTIVE_AREA_X1 12
635#define CAM_ACTIVE_AREA_Y1 10
636// note: the above contains some pixels which have valid data,
637// but are not at the same levels as the rest of the frame
638// the values below crop the "different" looking pixels.
639//#define CAM_ACTIVE_AREA_X1 16
640//#define CAM_ACTIVE_AREA_Y1 18
641#define CAM_ACTIVE_AREA_X2 3300
642#define CAM_ACTIVE_AREA_Y2 2480
643
644// camera name
645#define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
646
647#define CAM_EXT_TV_RANGE            1
648#define CAM_MULTIPART               1
649#define  CAM_CHDK_PTP               1 // include CHDK PTP support
650//----------------------------------------------------------
651
652#elif defined (CAMERA_a610)
653    #define CAM_PROPSET                 1
654
655    #define CAM_RAW_ROWPIX              2672   // for 5 MP
656    #define CAM_RAW_ROWS                1968   // for 5 MP
657   
658    #define CAM_SWIVEL_SCREEN           1
659    #define CAM_MULTIPART               1
660    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
661    #undef  CAM_HAS_IS
662    #define CAM_CAN_MUTE_MICROPHONE     1
663    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
664    #define CAM_EV_IN_VIDEO             1
665    #define CAM_EXT_TV_RANGE            1
666
667    // pattern
668    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
669    // color
670    #define CAM_COLORMATRIX1                               \
671      15887,  10000, -6524, 10000, -1622, 10000,           \
672     -5467,   10000, 13449, 10000,  2209, 10000,           \
673     -1325,   10000, 1859,  10000,  5172, 10000
674   
675    #define cam_CalibrationIlluminant1 17 // Standard light A
676    // cropping
677    #define CAM_JPEG_WIDTH  2592
678    #define CAM_JPEG_HEIGHT 1944
679    #define CAM_ACTIVE_AREA_X1 14
680    #define CAM_ACTIVE_AREA_Y1 10
681    #define CAM_ACTIVE_AREA_X2 2626
682    #define CAM_ACTIVE_AREA_Y2 1966
683    // camera name
684    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
685
686    #define DNG_EXT_FROM ".DPS"
687    #define  CAM_CHDK_PTP               1 // include CHDK PTP support
688//----------------------------------------------------------
689
690#elif defined (CAMERA_a620)
691    #define CAM_PROPSET                 1
692
693    #define CAM_RAW_ROWPIX              3152   // for 7 MP
694    #define CAM_RAW_ROWS                2340   // for 7 MP
695
696    #define CAM_SWIVEL_SCREEN           1
697    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
698    #undef  CAM_HAS_IS   
699    #define CAM_CAN_MUTE_MICROPHONE     1
700    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
701    #define CAM_EV_IN_VIDEO             1
702    // pattern
703    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
704    // color
705    #define CAM_COLORMATRIX1                               \
706     15265, 10000, -6193, 10000, -1558, 10000,             \
707     -4125, 10000, 12116, 10000,  2010, 10000,             \
708     -888,  10000,  1639, 10000,  5220, 10000
709
710    #define cam_CalibrationIlluminant1 17 // Standard light A
711    // cropping
712    #define CAM_JPEG_WIDTH  3072
713    #define CAM_JPEG_HEIGHT 2304
714    #define CAM_ACTIVE_AREA_X1 38
715    #define CAM_ACTIVE_AREA_Y1 14
716    #define CAM_ACTIVE_AREA_X2 3146
717    #define CAM_ACTIVE_AREA_Y2 2338
718    // camera name
719    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
720    #define DNG_EXT_FROM ".DPS"
721//----------------------------------------------------------
722
723#elif defined (CAMERA_a630)
724    #define CAM_PROPSET                 1
725
726    #define CAM_RAW_ROWPIX              3344   // for 8 MP
727    #define CAM_RAW_ROWS                2484   // for 8 MP
728   
729    #define CAM_SWIVEL_SCREEN           1
730    #define CAM_MULTIPART               1
731    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
732    #undef  CAM_HAS_IS
733    #define CAM_CAN_MUTE_MICROPHONE     1
734    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
735    #define CAM_EV_IN_VIDEO             1
736    // pattern
737    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
738    // color
739    #define CAM_COLORMATRIX1                               \
740      656080,  1000000,-226478, 1000000, -85884, 1000000,  \
741     -194636,  1000000, 687905, 1000000,  37862, 1000000,  \
742       22873,  1000000,  75523, 1000000, 265822, 1000000
743   
744    #define cam_CalibrationIlluminant1 1 // Daylight
745    // cropping
746    #define CAM_JPEG_WIDTH  3264
747    #define CAM_JPEG_HEIGHT 2448
748    #define CAM_ACTIVE_AREA_X1 14
749    #define CAM_ACTIVE_AREA_Y1 8
750    #define CAM_ACTIVE_AREA_X2 3298
751    #define CAM_ACTIVE_AREA_Y2 2476
752    // camera name
753    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
754    #define DNG_EXT_FROM ".DPS"
755    #define CAM_EXT_TV_RANGE            1
756//----------------------------------------------------------
757
758#elif defined (CAMERA_a640)
759    #define CAM_PROPSET                 1
760
761    #define CAM_RAW_ROWPIX              3736   // for 10 MP
762    #define CAM_RAW_ROWS                2772   // for 10 MP
763   
764    #define CAM_SWIVEL_SCREEN           1
765    #define CAM_MULTIPART               1
766    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
767    #undef  CAM_HAS_IS
768    #define CAM_CAN_MUTE_MICROPHONE     1
769    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
770    #define CAM_EV_IN_VIDEO             1
771    // pattern
772    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
773    // color
774    #define CAM_COLORMATRIX1                               \
775      13124,  10000, -5329, 10000, -1390, 10000,           \
776      -3602,  10000, 11658, 10000,  1944, 10000,           \
777      -1612,  10000,  2863, 10000,  4885, 10000
778   
779    #define cam_CalibrationIlluminant1 17 // Standard light A
780    // cropping
781    #define CAM_JPEG_WIDTH  3648
782    #define CAM_JPEG_HEIGHT 2736
783    #define CAM_ACTIVE_AREA_X1 14
784    #define CAM_ACTIVE_AREA_Y1 8
785    #define CAM_ACTIVE_AREA_X2 3682
786    #define CAM_ACTIVE_AREA_Y2 2764
787    // camera name
788    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
789    #define DNG_EXT_FROM ".DPS"
790//----------------------------------------------------------
791
792#elif defined (CAMERA_a650)
793    #define CAM_PROPSET                 2
794    #define CAM_DRYOS                   1
795
796    #define CAM_RAW_ROWPIX              4104   // for 12 MP
797    #define CAM_RAW_ROWS                3048   // for 12 MP
798   
799    #define CAM_ADJUSTABLE_ALT_BUTTON   1
800    #define CAM_SWIVEL_SCREEN           1
801    #define CAM_CAN_MUTE_MICROPHONE     1
802
803    #undef  CAM_EMUL_KEYPRESS_DURATION
804    #define CAM_EMUL_KEYPRESS_DURATION  10
805    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
806    #define CAM_EV_IN_VIDEO             1
807    // pattern
808    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
809    // color
810    #define CAM_COLORMATRIX1                               \
811      913762, 1000000, -261578, 1000000, -135582, 1000000, \
812     -99049,  1000000, 1067089, 1000000,   61442, 1000000, \
813      48717,  1000000, 96802,   1000000,  412056, 1000000
814   
815    #define cam_CalibrationIlluminant1 1 // Daylight
816    // cropping
817    #define CAM_JPEG_WIDTH  4000
818    #define CAM_JPEG_HEIGHT 3000
819    #define CAM_ACTIVE_AREA_X1 52
820    #define CAM_ACTIVE_AREA_Y1 14
821    #define CAM_ACTIVE_AREA_X2 4076
822    #define CAM_ACTIVE_AREA_Y2 3030
823    // camera name
824    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
825
826    #define DNG_EXT_FROM ".CR2"
827//----------------------------------------------------------
828
829#elif defined (CAMERA_a700)
830    #define CAM_PROPSET                 1
831
832    #define CAM_RAW_ROWPIX              2888   // for 6 MP
833    #define CAM_RAW_ROWS                2136   // for 6 MP
834
835    #undef  CAM_HAS_IS
836    #define CAM_CAN_MUTE_MICROPHONE     1
837    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
838    #define CAM_EV_IN_VIDEO             1
839    // pattern
840    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
841    // color
842    #define CAM_COLORMATRIX1                               \
843     14062, 10000, -5199, 10000, -1446, 10000,             \
844     -4712, 10000, 12470, 10000,  2243, 10000,             \
845     -1286, 10000,  2028, 10000,  4836, 10000
846   
847    #define cam_CalibrationIlluminant1 17 // Standard light A
848    // cropping
849    #define CAM_JPEG_WIDTH  2816
850    #define CAM_JPEG_HEIGHT 2112
851    #define CAM_ACTIVE_AREA_X1 44
852    #define CAM_ACTIVE_AREA_Y1 8
853    #define CAM_ACTIVE_AREA_X2 2884
854    #define CAM_ACTIVE_AREA_Y2 2136
855    // camera name
856    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
857    #define DNG_EXT_FROM ".DPS"
858//----------------------------------------------------------
859
860#elif defined (CAMERA_a710)
861    #define CAM_PROPSET                 1
862
863    #define CAM_RAW_ROWPIX              3152   // for 7 MP
864    #define CAM_RAW_ROWS                2340   // for 7 MP
865
866    #define CAM_MULTIPART               1
867    #define CAM_CAN_MUTE_MICROPHONE     1
868    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
869    #define CAM_EV_IN_VIDEO             1
870    #define CAM_REAR_CURTAIN            1 // http://chdk.setepontos.com/index.php/topic,650.msg54434.html#msg54434
871    // pattern
872    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
873    // color
874    #define CAM_COLORMATRIX1                   \
875     13349, 10000, -4141, 10000, -2128, 10000, \
876     -4189, 10000, 13178, 10000,  1044, 10000, \
877     -1037, 10000,  2326, 10000,  4720, 10000   
878   
879    #define cam_CalibrationIlluminant1 1 // Daylight
880    // cropping
881    #define CAM_JPEG_WIDTH  3072
882    #define CAM_JPEG_HEIGHT 2304
883    #define CAM_ACTIVE_AREA_X1 38
884    #define CAM_ACTIVE_AREA_Y1 14
885    #define CAM_ACTIVE_AREA_X2 3146
886    #define CAM_ACTIVE_AREA_Y2 2338
887    // camera name
888    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
889
890    #define DNG_EXT_FROM ".DPS"
891
892    #define CAM_EXT_TV_RANGE            1
893//----------------------------------------------------------
894
895#elif defined (CAMERA_a720)
896    #define CAM_PROPSET                 2
897    #define CAM_DRYOS                   1
898
899    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
900    #define CAM_RAW_ROWS                2480   // for new 8 MP
901
902    #define CAM_MULTIPART               1
903    #define CAM_ADJUSTABLE_ALT_BUTTON   1
904    #define CAM_CAN_MUTE_MICROPHONE     1
905    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
906    #define CAM_EV_IN_VIDEO             1
907    #undef  CAM_VIDEO_CONTROL
908    #define CAM_EXT_TV_RANGE            1
909
910    // pattern
911    #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
912    // color
913    #define CAM_COLORMATRIX1                               \
914      640019, 1000000, -220031, 1000000, -96241, 1000000,  \
915     -77419,  1000000, 639766,  1000000,  44009, 1000000,  \
916      17965,  1000000, 78396,   1000000, 231868, 1000000
917   
918    #define cam_CalibrationIlluminant1 1 // Daylight
919    // cropping
920    #define CAM_JPEG_WIDTH  3264
921    #define CAM_JPEG_HEIGHT 2448
922    #define CAM_ACTIVE_AREA_X1 10
923    #define CAM_ACTIVE_AREA_Y1 8
924    #define CAM_ACTIVE_AREA_X2 3302
925    #define CAM_ACTIVE_AREA_Y2 2474
926    // camera name
927    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
928
929    #define DNG_EXT_FROM ".CR2"
930    #define  CAM_CHDK_PTP               1 // include CHDK PTP support
931//----------------------------------------------------------
932
933#elif defined (CAMERA_a2000)
934        ////////////////////////////////
935        // Sure values
936        ////////////////////////////////
937    #define CAM_PROPSET                 2
938    #define CAM_DRYOS                   1
939
940    #define CAM_RAW_ROWPIX              3720 
941    #define CAM_RAW_ROWS                2772 
942
943    #define CAM_JPEG_WIDTH  3648
944    #define CAM_JPEG_HEIGHT 2736
945
946
947    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
948
949    #undef  CAM_HAS_IRIS_DIAPHRAGM
950    #define CAM_HAS_ND_FILTER           1
951
952    ////////////////////////////////
953    // Almost sure, sensor data taken from
954    // ixus870_sd880 which should have same sensor..
955    ////////////////////////////////
956    #undef CAM_SENSOR_BITS_PER_PIXEL
957    #undef CAM_WHITE_LEVEL
958    #undef CAM_BLACK_LEVEL
959    #define CAM_SENSOR_BITS_PER_PIXEL   12
960    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
961    #define CAM_BLACK_LEVEL             127
962
963    #define cam_CFAPattern              0x02010100 // Red  Green  Green  Blue
964    #define CAM_COLORMATRIX1                               \
965      827547, 1000000, -290458, 1000000, -126086, 1000000, \
966     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
967      5181,   1000000, 48183,   1000000, 245014,  1000000
968    #define cam_CalibrationIlluminant1  1 // Daylight
969
970    // cropping (from ixus870_sd880)
971    #define CAM_ACTIVE_AREA_X1          14
972    #define CAM_ACTIVE_AREA_Y1          8
973    #define CAM_ACTIVE_AREA_X2          3682
974    #define CAM_ACTIVE_AREA_Y2          2764
975
976    #undef  CAM_HAS_MANUAL_FOCUS
977// for the purposes of CHDK, the FACE button is treated as the erase button
978//    #undef  CAM_HAS_ERASE_BUTTON
979//----------------------------------------------------------
980
981#elif defined (CAMERA_d10)
982    #define CAM_PROPSET                 2
983    #define CAM_DRYOS                   1
984
985    #define CAM_RAW_ROWPIX              4104            // 12 MP 12bpp
986    #define CAM_RAW_ROWS                3048            // from " CrwAddress %lx, CrwSize H %ld V %ld\r"
987
988    #undef  CAM_HAS_ERASE_BUTTON
989    #undef  CAM_USE_ZOOM_FOR_MF
990    #define CAM_MULTIPART               1
991    #undef  CAM_HAS_IRIS_DIAPHRAGM
992    #define CAM_HAS_ND_FILTER           1
993
994    #define CAM_HAS_ZOOM_LEVER          1 // note, has zoom in/out buttons, not lever
995
996
997// TODO
998//    #define CAM_CAN_SD_OVER_NOT_IN_MF   1                     // Camera allows subject distance (focus) override when not in manual focus mode
999//    #define CAM_CAN_SD_OVERRIDE         1                     // Camera allows to do subject distance override
1000
1001    #define CAM_HAS_MANUAL_FOCUS                1
1002// long shutter is acutally user TV, may work ?
1003    #undef      CAM_HAS_USER_TV_MODES
1004    #define CAM_SHOW_OSD_IN_SHOOT_MENU            1
1005    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO  1
1006// TODO this doesn't seem to be working
1007    #define CAM_AF_SCAN_DURING_VIDEO_RECORD       1
1008    #define CAM_CHDK_HAS_EXT_VIDEO_MENU   1 // In CHDK for this camera realized adjustable video compression
1009
1010    #define CAM_HAS_IS                  1
1011    #undef CAM_HAS_JOGDIAL
1012
1013    #undef  CAM_VIDEO_CONTROL
1014    #define CAM_VIDEO_QUALITY_ONLY      1
1015
1016
1017//    #define CAM_EXT_TV_RANGE            1
1018
1019    #undef CAM_UNCACHED_BIT
1020    #define CAM_UNCACHED_BIT            0x40000000
1021
1022    #undef CAM_BITMAP_PALETTE
1023// OK looks similar to ixus100 based on forum posts
1024    #define CAM_BITMAP_PALETTE          5
1025
1026    #define CAM_QUALITY_OVERRIDE 1
1027    #undef CAM_SENSOR_BITS_PER_PIXEL
1028    #define CAM_SENSOR_BITS_PER_PIXEL   12
1029    #undef CAM_WHITE_LEVEL
1030    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
1031    #undef CAM_BLACK_LEVEL
1032    #define CAM_BLACK_LEVEL             127
1033
1034        #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
1035
1036    #define CAM_COLORMATRIX1                               \
1037      14052, 10000, -5229, 10000, -1156, 10000, \
1038      -1325, 10000,  9420, 10000,  2252, 10000, \
1039       -498, 10000,  1957, 10000,  4116, 10000
1040    #define cam_CalibrationIlluminant1  21                      // D65
1041
1042        // cropping OK
1043    #define CAM_JPEG_WIDTH              4000
1044    #define CAM_JPEG_HEIGHT             3000
1045    #define CAM_ACTIVE_AREA_X1          0 // some data all the way to left, normal 8 ?
1046    #define CAM_ACTIVE_AREA_Y1          10
1047    #define CAM_ACTIVE_AREA_X2          4072 // or 4024
1048    #define CAM_ACTIVE_AREA_Y2          3040 // or 3041 or 3020
1049
1050    // camera name OK
1051    #define PARAM_CAMERA_NAME           4                       // parameter number for GetParameterData
1052
1053    // XXXX
1054    #undef CAM_USES_ASPECT_CORRECTION
1055    #undef CAM_USES_ASPECT_YCORRECTION
1056    #define CAM_USES_ASPECT_CORRECTION          1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
1057    #define CAM_USES_ASPECT_YCORRECTION         0  //only uses mappings on x coordinate
1058
1059    #undef ASPECT_XCORRECTION
1060    #define ASPECT_XCORRECTION(x)   ( ((x)<<1) )
1061
1062    // Note color palette affects grids!
1063    #undef ASPECT_GRID_XCORRECTION
1064    #define ASPECT_GRID_XCORRECTION(x)   ( (x) )
1065
1066    #undef ASPECT_GRID_YCORRECTION
1067    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )
1068
1069    #undef ASPECT_VIEWPORT_XCORRECTION
1070    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x)
1071    #undef ASPECT_VIEWPORT_YCORRECTION
1072    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
1073
1074    // Note color palette affects games!
1075        //games mappings
1076        #undef GAMES_SCREEN_WIDTH
1077        #undef GAMES_SCREEN_HEIGHT
1078        #define GAMES_SCREEN_WIDTH              360
1079        #define GAMES_SCREEN_HEIGHT             240
1080        #undef ASPECT_GAMES_XCORRECTION
1081        // 720/360=2 same aspect than grids and viewport but another approach: there is a lot of corrections to do in game's code, and we decide to paint directly on display buffer wirh another resolution
1082        // used by gui.c that configures the draw environment (trhough new draw_gui function) depending on gui_mode: we have then 360x240 for games (but deformed output:circles are not circles) and 320x240 for
1083        // other modes in perfect aspect ratio 4/3: slightly better visualization: file menus more readable, ...
1084        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
1085        #undef ASPECT_GAMES_YCORRECTION
1086        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
1087
1088    #define CAM_ZEBRA_ASPECT_ADJUST 1
1089
1090    #define  CAM_CHDK_PTP               1 // include CHDK PTP support
1091
1092//----------------------------------------------------------
1093
1094
1095//==========================================================
1096// SD-Series (IXUS-Series)
1097//==========================================================
1098#elif defined (CAMERA_ixus40_sd300)
1099    #define CAM_PROPSET                 1
1100
1101    #define CAM_RAW_ROWPIX              2400
1102    #define CAM_RAW_ROWS                1766
1103
1104    #define CAM_USE_ZOOM_FOR_MF 1
1105    #undef  CAM_HAS_ERASE_BUTTON
1106    #undef  CAM_HAS_IRIS_DIAPHRAGM
1107    #define CAM_HAS_ND_FILTER           1
1108    #undef  CAM_HAS_MANUAL_FOCUS
1109    #undef  CAM_HAS_USER_TV_MODES
1110    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1111    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
1112    #undef  CAM_HAS_IS
1113    #undef CAM_CONSOLE_LOG_ENABLED
1114
1115
1116    // pattern
1117    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1118    // color
1119    #define CAM_COLORMATRIX1                                 \
1120      652674,  1000000, -172074, 1000000, -107575,  1000000, \
1121      -139063, 1000000, 594517,  1000000,  60252,   1000000, \
1122      -9088,   1000000, 82013,   1000000,  238080,  1000000
1123   
1124    #define cam_CalibrationIlluminant1 1 // Daylight
1125    // cropping
1126    #define CAM_JPEG_WIDTH  2272
1127    #define CAM_JPEG_HEIGHT 1704
1128    #define CAM_ACTIVE_AREA_X1 12
1129    #define CAM_ACTIVE_AREA_Y1 12
1130    #define CAM_ACTIVE_AREA_X2 2356
1131    #define CAM_ACTIVE_AREA_Y2 1764
1132    // camera name
1133    #define PARAM_CAMERA_NAME 2 // parameter number for GetParameterData
1134//----------------------------------------------------------
1135
1136#elif defined (CAMERA_ixus50_sd400)
1137    #define CAM_PROPSET                 1
1138
1139    #define CAM_RAW_ROWPIX              2672   // for 5 MP
1140    #define CAM_RAW_ROWS                1968   // for 5 MP
1141
1142    #undef  CAM_SYNCH 
1143    #undef  CAM_USE_ZOOM_FOR_MF
1144    #undef  CAM_HAS_ERASE_BUTTON
1145    #undef  CAM_HAS_IRIS_DIAPHRAGM
1146    #define CAM_HAS_ND_FILTER           1
1147    #undef  CAM_HAS_MANUAL_FOCUS
1148    #undef  CAM_HAS_USER_TV_MODES
1149    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1150    #undef  CAM_HAS_IS
1151        //#define CAM_CONSOLE_LOG_ENABLED     1
1152    #undef  CAM_VIDEO_CONTROL
1153    // pattern
1154    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1155    // color
1156    #define CAM_COLORMATRIX1                                  \
1157      685247,  1000000, -204939,  1000000, -106531,  1000000, \
1158     -267616,  1000000,  790509,  1000000,   73359,  1000000, \
1159       32401,  1000000,   15655,  1000000,  314892,  1000000
1160   
1161    #define cam_CalibrationIlluminant1 1 // Daylight
1162    // cropping
1163    #define CAM_JPEG_WIDTH  2592
1164    #define CAM_JPEG_HEIGHT 1944
1165    #define CAM_ACTIVE_AREA_X1 12
1166    #define CAM_ACTIVE_AREA_Y1 8
1167    #define CAM_ACTIVE_AREA_X2 2628
1168    #define CAM_ACTIVE_AREA_Y2 1968
1169    // camera name
1170    #define PARAM_CAMERA_NAME 2 // parameter number for GetParameterData
1171//----------------------------------------------------------
1172
1173#elif defined (CAMERA_ixusizoom_sd30)
1174    #define CAM_PROPSET                 1
1175
1176    #define CAM_RAW_ROWPIX              2672   // for 5 MP
1177    #define CAM_RAW_ROWS                1968   // for 5 MP
1178
1179    #undef  CAM_SYNCH 
1180    #undef  CAM_USE_ZOOM_FOR_MF
1181    #undef  CAM_HAS_ERASE_BUTTON
1182    #undef  CAM_HAS_IRIS_DIAPHRAGM
1183    #define CAM_HAS_ND_FILTER           1
1184    #undef  CAM_HAS_MANUAL_FOCUS
1185    #undef  CAM_HAS_USER_TV_MODES
1186    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1187    #undef  CAM_HAS_IS
1188        //#define CAM_CONSOLE_LOG_ENABLED     1
1189    #undef  CAM_VIDEO_CONTROL
1190        #undef  DNG_SUPPORT
1191//----------------------------------------------------------
1192
1193#elif defined (CAMERA_ixus55_sd450)
1194    #define CAM_PROPSET                 1
1195
1196    #define CAM_RAW_ROWPIX              2672   // for 5 MP
1197    #define CAM_RAW_ROWS                1968   // for 5 MP
1198
1199    #undef  CAM_USE_ZOOM_FOR_MF
1200    #undef  CAM_HAS_ERASE_BUTTON
1201    #undef  CAM_HAS_IRIS_DIAPHRAGM
1202    #define CAM_HAS_ND_FILTER           1
1203    #undef  CAM_HAS_MANUAL_FOCUS
1204    #undef  CAM_HAS_USER_TV_MODES
1205    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1206    #undef  CAM_HAS_IS
1207    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
1208    // pattern
1209    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1210    // color
1211    #define CAM_COLORMATRIX1                                \
1212      536034,  1000000, -173429, 1000000, -89823,  1000000, \
1213      -290416, 1000000, 735807,  1000000,  47894,  1000000, \
1214      -71455,  1000000, 114314,  1000000,  274533, 1000000         
1215   
1216    #define cam_CalibrationIlluminant1 1 // Daylight
1217    // cropping
1218    #define CAM_JPEG_WIDTH  2592
1219    #define CAM_JPEG_HEIGHT 1944
1220    #define CAM_ACTIVE_AREA_X1 12
1221    #define CAM_ACTIVE_AREA_Y1 8
1222    #define CAM_ACTIVE_AREA_X2 2628
1223    #define CAM_ACTIVE_AREA_Y2 1968
1224    // camera name
1225    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
1226    #define DNG_EXT_FROM ".DPS"
1227//----------------------------------------------------------
1228
1229#elif defined (CAMERA_ixus60_sd600)
1230    #define CAM_PROPSET                 1
1231
1232    #define CAM_RAW_ROWPIX              2888   // for 6 MP
1233    #define CAM_RAW_ROWS                2136   // for 6 MP
1234
1235    #undef  CAM_SYNCH
1236    #undef  CAM_USE_ZOOM_FOR_MF
1237    #undef  CAM_HAS_ERASE_BUTTON
1238    #undef  CAM_HAS_IRIS_DIAPHRAGM
1239    #define CAM_HAS_ND_FILTER           1
1240    #undef  CAM_HAS_MANUAL_FOCUS
1241    #undef  CAM_HAS_USER_TV_MODES
1242    #define CAM_DRAW_EXPOSITION             1
1243    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1244    #define CAM_FEATURE_FEATHER         1
1245
1246//    #define CAM_CONSOLE_LOG_ENABLED     1  //100a won't compile if this is defined ("undefined reference to `_iosDevFind'")
1247    #undef  CAM_CHDK_HAS_EXT_VIDEO_MENU
1248    #undef  CAM_HAS_IS
1249    // pattern
1250    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1251    // color
1252    #define CAM_COLORMATRIX1                                \
1253      767398,  1000000, -227658, 1000000, -144213, 1000000, \
1254      -217466, 1000000, 669319,  1000000,  38180,  1000000, \
1255      -23152,  1000000, 77743,  1000000,   238669, 1000000
1256   
1257    #define cam_CalibrationIlluminant1 1 // Daylight
1258    // cropping
1259    #define CAM_JPEG_WIDTH  2816
1260    #define CAM_JPEG_HEIGHT 2112
1261    #define CAM_ACTIVE_AREA_X1 44
1262    #define CAM_ACTIVE_AREA_Y1 8
1263    #define CAM_ACTIVE_AREA_X2 2884
1264    #define CAM_ACTIVE_AREA_Y2 2136
1265    // camera name
1266    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
1267//----------------------------------------------------------
1268
1269#elif defined (CAMERA_ixus65_sd630)
1270    #define CAM_PROPSET                 1
1271
1272    #define CAM_RAW_ROWPIX              2888   // for 6 MP
1273    #define CAM_RAW_ROWS                2136   // for 6 MP
1274
1275    #undef  CAM_USE_ZOOM_FOR_MF
1276    #undef  CAM_HAS_ERASE_BUTTON
1277    #undef  CAM_HAS_IRIS_DIAPHRAGM
1278    #define CAM_HAS_ND_FILTER           1
1279    #undef  CAM_HAS_MANUAL_FOCUS
1280    #undef  CAM_HAS_USER_TV_MODES
1281    #define CAM_DRAW_EXPOSITION             1
1282    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1283    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
1284    #define CAM_FEATURE_FEATHER         1
1285
1286    #define CAM_CONSOLE_LOG_ENABLED     1
1287    #undef  CAM_HAS_IS
1288    #undef  CAM_CHDK_HAS_EXT_VIDEO_MENU
1289    // pattern
1290    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1291    // color
1292    #define CAM_COLORMATRIX1                                \
1293      783384,  1000000, -227078, 1000000, -127919, 1000000, \
1294      -181247, 1000000, 661743,  1000000,  58868,  1000000, \
1295       25727,  1000000, 43891,   1000000,  247655, 1000000         
1296   
1297    #define cam_CalibrationIlluminant1 1 // Daylight
1298    // cropping
1299    #define CAM_JPEG_WIDTH  2816
1300    #define CAM_JPEG_HEIGHT 2112
1301    #define CAM_ACTIVE_AREA_X1 44
1302    #define CAM_ACTIVE_AREA_Y1 8
1303    #define CAM_ACTIVE_AREA_X2 2884
1304    #define CAM_ACTIVE_AREA_Y2 2136
1305    // camera name
1306    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
1307    #define DNG_EXT_FROM ".DPS"
1308//----------------------------------------------------------
1309
1310#elif defined (CAMERA_ixus75_sd750)
1311    #define CAM_PROPSET                 2
1312
1313    #define CAM_RAW_ROWPIX              3152   // for 7 MP
1314    #define CAM_RAW_ROWS                2340   // for 7 MP
1315
1316/*
1317    #undef  CAM_USE_ZOOM_FOR_MF
1318    #undef  CAM_HAS_ERASE_BUTTON
1319    #undef  CAM_HAS_IRIS_DIAPHRAGM
1320    #define CAM_HAS_ND_FILTER           1
1321    #undef  CAM_HAS_MANUAL_FOCUS
1322    #undef  CAM_HAS_USER_TV_MODES
1323    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1324    #undef  CAM_HAS_IS
1325    */
1326   
1327    #undef  CAM_SWIVEL_SCREEN               // Camera has rotated LCD screen
1328    #undef CAM_USE_ZOOM_FOR_MF            // Zoom lever can be used for manual focus adjustments
1329    #undef  CAM_ADJUSTABLE_ALT_BUTTON       // ALT-button can be set from menu
1330    #undef CAM_REMOTE                     // Camera supports USB-remote
1331    #define CAM_MULTIPART               1   // Camera supports SD-card multipartitioning
1332    #define CAM_HAS_ZOOM_LEVER          1   // Camera has dedicated zoom buttons
1333    #undef  CAM_DRAW_EXPOSITION             // Output expo-pair on screen (for cameras which (sometimes) don't do that)
1334    #undef CAM_HAS_ERASE_BUTTON           // Camera has dedicated erase button
1335    #undef  CAM_HAS_IRIS_DIAPHRAGM
1336    #define  CAM_HAS_ND_FILTER         1      // Camera has build-in ND filter
1337    #undef CAM_CAN_SD_OVER_NOT_IN_MF      // Camera allows subject distance (focus) override when not in manual focus mode
1338    #undef CAM_CAN_SD_OVERRIDE            // Camera allows to do subject distance override
1339    #undef CAM_HAS_MANUAL_FOCUS           // Camera has manual focus mode
1340    #define CAM_HAS_USER_TV_MODES       1   // Camera has tv-priority or manual modes with ability to set tv value
1341    #define  CAM_SHOW_OSD_IN_SHOOT_MENU   1   // On some cameras Canon shoot menu has additional functionality and useful in this case to see CHDK OSD in this mode 
1342//    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO // adress for zoom_status missing, probably more
1343    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO  1 // Camera can unlock optical zoom in video (if it is locked)
1344    #define  CAM_FEATURE_FEATHER        1     // Cameras with "feather" or touch wheel.
1345    #undef CAM_HAS_IS                     // Camera has image stabilizer
1346
1347//    #define  CAM_CONSOLE_LOG_ENABLED   1      // Development: internal camera stdout -> A/stdout.txt       
1348    // pattern
1349    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1350    // color
1351    #define CAM_COLORMATRIX1                                \
1352      689833,  1000000, -198299, 1000000, -101299, 1000000, \
1353      -164267, 1000000, 667466,  1000000,  74132,  1000000, \
1354       -36515,  1000000, 123872,   1000000,  248498, 1000000
1355   
1356    #define cam_CalibrationIlluminant1 1 // Daylight
1357    // cropping
1358    #define CAM_JPEG_WIDTH  3072
1359    #define CAM_JPEG_HEIGHT 2304
1360    #define CAM_ACTIVE_AREA_X1 38
1361    #define CAM_ACTIVE_AREA_Y1 14
1362    #define CAM_ACTIVE_AREA_X2 3146
1363    #define CAM_ACTIVE_AREA_Y2 2338
1364    // camera name
1365    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
1366   
1367    #define DNG_EXT_FROM ".DPS"
1368//----------------------------------------------------------
1369
1370#elif defined (CAMERA_ixus70_sd1000)
1371    #define CAM_PROPSET                 2
1372
1373    #define CAM_RAW_ROWPIX              3152   // for 7 MP
1374    #define CAM_RAW_ROWS                2340   // for 7 MP
1375
1376    #undef  CAM_USE_ZOOM_FOR_MF
1377    #undef  CAM_HAS_ERASE_BUTTON
1378    #undef  CAM_HAS_IRIS_DIAPHRAGM
1379    #define CAM_HAS_ND_FILTER           1
1380    #undef  CAM_HAS_MANUAL_FOCUS
1381    #undef  CAM_HAS_USER_TV_MODES
1382    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1383    #undef  CAM_HAS_IS
1384    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
1385    #define CAM_MULTIPART               1
1386    // pattern
1387    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1388    // color
1389    #define CAM_COLORMATRIX1                                \
1390      652674,  1000000, -172074, 1000000, -107575, 1000000, \
1391      -139063, 1000000, 594517,  1000000,  60252,  1000000, \
1392       -9088,  1000000, 82013,   1000000,  238048, 1000000
1393   
1394    #define cam_CalibrationIlluminant1 1 // Daylight
1395    // cropping
1396    #define CAM_JPEG_WIDTH  3072
1397    #define CAM_JPEG_HEIGHT 2304
1398    #define CAM_ACTIVE_AREA_X1 38
1399    #define CAM_ACTIVE_AREA_Y1 14
1400    #define CAM_ACTIVE_AREA_X2 3146
1401    #define CAM_ACTIVE_AREA_Y2 2338
1402    // camera name
1403    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
1404
1405    #define DNG_EXT_FROM ".DPS"
1406
1407    #define CAM_EXT_TV_RANGE            1
1408//----------------------------------------------------------
1409
1410#elif defined (CAMERA_ixus80_sd1100)
1411    #define CAM_PROPSET                 2
1412    #define CAM_DRYOS                   1
1413
1414    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
1415    #define CAM_RAW_ROWS                2480   // for new 8 MP
1416
1417    #undef  CAM_USE_ZOOM_FOR_MF
1418    #undef  CAM_HAS_ERASE_BUTTON
1419    #undef  CAM_HAS_IRIS_DIAPHRAGM
1420    #define CAM_HAS_ND_FILTER           1
1421    #undef  CAM_HAS_MANUAL_FOCUS
1422    #undef  CAM_HAS_USER_TV_MODES
1423    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1424        // TODO / test
1425        #undef  CAM_REMOTE
1426        #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
1427    #undef  CAM_CAN_MUTE_MICROPHONE
1428    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 0
1429    // pattern
1430    #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
1431    // color
1432    #define CAM_COLORMATRIX1                                \
1433      893969,  1000000, -343107, 1000000, -119590, 1000000, \
1434      -41350,  1000000, 581255,  1000000,  49523,  1000000, \
1435       24221,  1000000, 47554,   1000000,  209996, 1000000
1436   
1437    #define cam_CalibrationIlluminant1 1 // Daylight
1438    // cropping
1439    #define CAM_JPEG_WIDTH  3264
1440    #define CAM_JPEG_HEIGHT 2448
1441    #define CAM_ACTIVE_AREA_X1 6
1442    #define CAM_ACTIVE_AREA_Y1 6
1443    #define CAM_ACTIVE_AREA_X2 3304
1444    #define CAM_ACTIVE_AREA_Y2 2476
1445    // camera name
1446    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
1447
1448    #define CAM_EXT_TV_RANGE            1
1449//----------------------------------------------------------
1450
1451#elif defined (CAMERA_ixus700_sd500)
1452    #define CAM_PROPSET                 1
1453
1454    #define CAM_RAW_ROWPIX              3152   // for 7 MP
1455    #define CAM_RAW_ROWS                2340   // for 7 MP
1456
1457    #undef  CAM_SYNCH
1458    #undef  CAM_USE_ZOOM_FOR_MF
1459    #define CAM_DRAW_EXPOSITION         1
1460    #undef  CAM_HAS_ERASE_BUTTON
1461    #undef  CAM_HAS_IRIS_DIAPHRAGM
1462    #define CAM_HAS_ND_FILTER           1
1463    #undef  CAM_HAS_MANUAL_FOCUS
1464    #undef  CAM_HAS_USER_TV_MODES
1465    #undef  CAM_CAN_SD_OVERRIDE
1466    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1467    #undef  CAM_HAS_IS
1468    #define CAM_MULTIPART               1
1469    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
1470    // pattern
1471    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1472    // color
1473    #define CAM_COLORMATRIX1         \
1474      15265, 1, -6193,  1, -1558, 1, \
1475     -4125,  1,  12116, 1,  2010, 1, \
1476      -888,  1,  1639,  1,  5220, 1
1477   
1478    #define cam_CalibrationIlluminant1 17 // Standard light A
1479    // cropping
1480    #define CAM_JPEG_WIDTH  3072
1481    #define CAM_JPEG_HEIGHT 2304
1482    #define CAM_ACTIVE_AREA_X1 38
1483    #define CAM_ACTIVE_AREA_Y1 14
1484    #define CAM_ACTIVE_AREA_X2 3146
1485    #define CAM_ACTIVE_AREA_Y2 2338
1486    // camera name
1487    #define PARAM_CAMERA_NAME 2 // parameter number for GetParameterData
1488    #define DNG_EXT_FROM ".DPS"
1489//----------------------------------------------------------
1490
1491#elif defined (CAMERA_ixus750_sd550)
1492    #define CAM_PROPSET                1
1493
1494    #define CAM_RAW_ROWPIX              3152  // for 7 MP
1495    #define CAM_RAW_ROWS                2340  // for 7 MP
1496
1497    #define  CAM_USE_ZOOM_FOR_MF    1
1498    #define CAM_DRAW_EXPOSITION        1
1499    #undef  CAM_HAS_ERASE_BUTTON
1500    #undef  CAM_HAS_IRIS_DIAPHRAGM
1501    #define CAM_HAS_ND_FILTER          1
1502    #undef  CAM_HAS_MANUAL_FOCUS
1503    #undef  CAM_HAS_USER_TV_MODES
1504    #define  CAM_CAN_SD_OVERRIDE    1
1505    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1506    #undef  CAM_HAS_IS
1507    #define CAM_MULTIPART              1
1508    #undef CAM_SYNCH
1509    // pattern
1510    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1511    // color
1512    #define CAM_COLORMATRIX1                               \
1513      580280, 1000000, -172239, 1000000, -89707,  1000000, \
1514     -206596, 1000000,  634926, 1000000,  63877,  1000000, \
1515      10377,  1000000,  62053,  1000000,  242646, 1000000
1516   
1517    #define cam_CalibrationIlluminant1 1 // Daylight
1518    // cropping
1519    #define CAM_JPEG_WIDTH  3072
1520    #define CAM_JPEG_HEIGHT 2304
1521    #define CAM_ACTIVE_AREA_X1 36
1522    #define CAM_ACTIVE_AREA_Y1 12
1523    #define CAM_ACTIVE_AREA_X2 3148
1524    #define CAM_ACTIVE_AREA_Y2 2340
1525    // camera name
1526    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
1527//----------------------------------------------------------
1528
1529#elif defined (CAMERA_ixus800_sd700)
1530    #define CAM_PROPSET                 1
1531
1532    #define CAM_RAW_ROWPIX              2888   // for 6 MP
1533    #define CAM_RAW_ROWS                2136   // for 6 MP
1534
1535    #undef  CAM_USE_ZOOM_FOR_MF
1536    #define CAM_DRAW_EXPOSITION         1
1537    #undef  CAM_HAS_ERASE_BUTTON
1538    #undef  CAM_HAS_IRIS_DIAPHRAGM
1539    #define CAM_HAS_ND_FILTER           1
1540    #undef  CAM_HAS_MANUAL_FOCUS
1541    #undef  CAM_HAS_USER_TV_MODES
1542    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1543    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 2
1544
1545 // Warning! DNG4PS2 has both ixus800 and sd700 support with different CFA patterns and color matrices.
1546 // Used settings for IXUS800
1547
1548    // pattern
1549    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1550    // color
1551    #define CAM_COLORMATRIX1          \
1552      14062, 1, -5199,  1, -1446,  1, \
1553      -4712, 1,  12470, 1,  2243,  1, \
1554      -1286, 1,  2028,  1,  4836,  1
1555   
1556    #define cam_CalibrationIlluminant1 17 // Standard light A
1557    // cropping
1558    #define CAM_JPEG_WIDTH  2816
1559    #define CAM_JPEG_HEIGHT 2112
1560    #define CAM_ACTIVE_AREA_X1 44
1561    #define CAM_ACTIVE_AREA_Y1 8
1562    #define CAM_ACTIVE_AREA_X2 2884
1563    #define CAM_ACTIVE_AREA_Y2 2136
1564    // camera name
1565    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
1566    #define DNG_EXT_FROM ".DPS"
1567//----------------------------------------------------------
1568
1569#elif defined (CAMERA_ixus850_sd800)
1570    #define CAM_PROPSET                 1
1571
1572    #define CAM_RAW_ROWPIX              3152   // for 7 MP
1573    #define CAM_RAW_ROWS                2340   // for 7 MP
1574
1575    #undef  CAM_USE_ZOOM_FOR_MF
1576    #undef  CAM_HAS_ERASE_BUTTON
1577    #undef  CAM_HAS_IRIS_DIAPHRAGM
1578    #define CAM_HAS_ND_FILTER           1
1579    #undef  CAM_HAS_MANUAL_FOCUS
1580    #undef  CAM_HAS_USER_TV_MODES
1581    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1582    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
1583    #define CAM_MULTIPART               1
1584    // pattern
1585    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1586    // color
1587    #define CAM_COLORMATRIX1                               \
1588      661014, 1000000, -189364, 1000000, -115797, 1000000, \
1589     -168772, 1000000,  661827, 1000000,   47392, 1000000, \
1590      -35846, 1000000,  107148, 1000000,  233705, 1000000
1591
1592    #define cam_CalibrationIlluminant1 17 // Standard light A
1593    // cropping
1594    #define CAM_JPEG_WIDTH  3072
1595    #define CAM_JPEG_HEIGHT 2304
1596    #define CAM_ACTIVE_AREA_X1 12
1597    #define CAM_ACTIVE_AREA_Y1 8
1598    #define CAM_ACTIVE_AREA_X2 3108
1599    #define CAM_ACTIVE_AREA_Y2 2332
1600    // camera name
1601    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
1602
1603    #define DNG_EXT_FROM ".DPS"
1604//----------------------------------------------------------
1605
1606#elif defined (CAMERA_ixus900_sd900)
1607    #define CAM_PROPSET                 1   // ToDo: test if correct
1608
1609    #define CAM_RAW_ROWPIX              3672   // value from RAW file (3648px + 24px)
1610    #define CAM_RAW_ROWS                2760   // value from RAW file (2736 + 24px)
1611
1612    //#undef  CAM_USE_ZOOM_FOR_MF
1613    #define CAM_DRAW_EXPOSITION         1   // ToDo: test if required
1614    #undef  CAM_HAS_ERASE_BUTTON
1615    #undef  CAM_HAS_IRIS_DIAPHRAGM
1616    #define CAM_HAS_ND_FILTER           1
1617    //#undef  CAM_CAN_SD_OVER_NOT_IN_MF
1618    //#undef  CAM_CAN_SD_OVERRIDE
1619    #undef  CAM_HAS_IS
1620    #undef  CAM_HAS_MANUAL_FOCUS
1621    #undef  CAM_HAS_USER_TV_MODES
1622    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1   // force CHDK OSD to show in record more
1623    #define CAM_FEATURE_FEATHER         1
1624    //#define CAM_CONSOLE_LOG_ENABLED     1   // ToDo: LOG stuff is disabled/removed
1625    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
1626    #define CAM_MULTIPART               1
1627
1628    // pattern
1629    #define cam_CFAPattern 0x02010100   // Red  Green  Green  Blue
1630    // color (from G7)
1631    #define CAM_COLORMATRIX1                              \
1632      575419, 1000000,-185557, 1000000, -77898,  1000000, \
1633     -213702, 1000000, 733569, 1000000,   81514, 1000000, \
1634      -24604, 1000000, 131906, 1000000,  280378, 1000000
1635    /*
1636    // SD800
1637    #define CAM_COLORMATRIX1                               \
1638      661014, 1000000, -189364, 1000000, -115797, 1000000, \
1639     -168772, 1000000,  661827, 1000000,   47392, 1000000, \
1640      -35846, 1000000,  107148, 1000000,  233705, 1000000
1641    */
1642    #define cam_CalibrationIlluminant1 1   // ToDo: Daylight (first selectable Illuminant Calibration mode ?)
1643
1644    // cropping
1645    #define CAM_JPEG_WIDTH  3648
1646    #define CAM_JPEG_HEIGHT 2736
1647    #define CAM_ACTIVE_AREA_X1 14   // ??? from G7, A640
1648    #define CAM_ACTIVE_AREA_Y1 8   // ??? from G7, A640
1649    //#define CAM_ACTIVE_AREA_X2 3672   // from RAW file
1650    //#define CAM_ACTIVE_AREA_Y2 2760   // from RAW file
1651    #define CAM_ACTIVE_AREA_X2 3682   // ??? from G7, A640, CAM_JPEG_WIDTH + 40
1652    #define CAM_ACTIVE_AREA_Y2 2764   // ??? from G7, A640, CAM_JPEG_HEIGHT + 40
1653    // camera name
1654    #define PARAM_CAMERA_NAME 4   // camera param id of EXIF camera model
1655
1656    #define DNG_EXT_TO   ".DPS"
1657//----------------------------------------------------------
1658
1659#elif defined (CAMERA_ixus860_sd870)
1660    #define CAM_PROPSET                 2
1661    #define CAM_DRYOS                   1
1662
1663    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
1664    #define CAM_RAW_ROWS                2480   // for new 8 MP
1665
1666    #undef  CAM_USE_ZOOM_FOR_MF
1667    #undef  CAM_HAS_ERASE_BUTTON
1668    #undef  CAM_HAS_IRIS_DIAPHRAGM
1669    #define CAM_HAS_ND_FILTER           1
1670    #undef  CAM_HAS_MANUAL_FOCUS
1671    #undef  CAM_HAS_USER_TV_MODES
1672    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1673        #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
1674    #undef  CAM_CAN_MUTE_MICROPHONE
1675    #undef  CAM_VIDEO_CONTROL
1676    // pattern
1677    #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
1678    // color
1679    #define CAM_COLORMATRIX1                               \
1680      747939, 1000000, -268233, 1000000, -129266, 1000000, \
1681     -50633,  1000000, 515687,  1000000,  23509,  1000000, \
1682     -21341,  1000000, 76495,   1000000, 186385,  1000000
1683
1684    #define cam_CalibrationIlluminant1 1 // Daylight                   
1685    // cropping
1686    #define CAM_JPEG_WIDTH  3264
1687    #define CAM_JPEG_HEIGHT 2448
1688    #define CAM_ACTIVE_AREA_X1 10
1689    #define CAM_ACTIVE_AREA_Y1 8
1690    #define CAM_ACTIVE_AREA_X2 3302
1691    #define CAM_ACTIVE_AREA_Y2 2474
1692    // camera name
1693    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
1694
1695    #define DNG_EXT_FROM ".CR2"
1696//----------------------------------------------------------
1697
1698#elif defined (CAMERA_ixus870_sd880)
1699    // Camera details
1700    #define CAM_DRYOS                   1
1701    #define CAM_PROPSET                 2
1702
1703    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
1704    #define CAM_BITMAP_PALETTE          1
1705    #define CAM_BRACKETING              1   // XXX
1706    #define CAM_CAN_SD_OVER_NOT_IN_MF   1
1707    #define CAM_CAN_SD_OVERRIDE         1
1708    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
1709    #define CAM_EXT_TV_RANGE            1
1710    #define CAM_HAS_IS                  1
1711    #define CAM_HAS_JOGDIAL             1
1712    #define CAM_HAS_ND_FILTER           1
1713    #define CAM_HAS_ZOOM_LEVER          1
1714    #define CAM_MULTIPART               1
1715    #define CAM_REMOTE                  1
1716    #define CAM_SYNCH                   1
1717    #define CAM_CHDK_PTP                1
1718    #undef CAM_UNCACHED_BIT
1719    #define CAM_UNCACHED_BIT            0x40000000  // 0xFF874198 (via ExMem.FreeCacheable
1720    #define PARAM_CAMERA_NAME           4 // parameter number for GetParameterData
1721
1722    #undef  CAM_CAN_MUTE_MICROPHONE         // XXX
1723    #undef  CAM_HAS_ERASE_BUTTON
1724    #undef  CAM_HAS_IRIS_DIAPHRAGM
1725    #undef  CAM_HAS_MANUAL_FOCUS
1726    #undef  CAM_HAS_USER_TV_MODES           // XXX
1727    #undef  CAM_HAS_VIDEO_BUTTON            // XXX
1728    #undef  CAM_EV_IN_VIDEO                 // XXX
1729    #undef  CAM_REAR_CURTAIN
1730
1731    #define CAM_JPEG_WIDTH              3648
1732    #define CAM_JPEG_HEIGHT             2736
1733    #define CAM_RAW_ROWPIX              3720
1734    #define CAM_RAW_ROWS                2772
1735    #define CAM_ACTIVE_AREA_X1          14       // XXX
1736    #define CAM_ACTIVE_AREA_Y1          8        // XXX
1737    #define CAM_ACTIVE_AREA_X2          3682     // XXX
1738    #define CAM_ACTIVE_AREA_Y2          2764     // XXX
1739
1740    #undef CAM_SENSOR_BITS_PER_PIXEL
1741    #undef CAM_WHITE_LEVEL
1742    #undef CAM_BLACK_LEVEL
1743    #define CAM_SENSOR_BITS_PER_PIXEL   12
1744    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1) // XXX
1745    #define CAM_BLACK_LEVEL             127 // XXX
1746
1747    #define cam_CFAPattern              0x02010100 // Red  Green  Green  Blue
1748    #define CAM_COLORMATRIX1                               \
1749      827547, 1000000, -290458, 1000000, -126086, 1000000, \
1750     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
1751      5181,   1000000, 48183,   1000000, 245014,  1000000    // XXX
1752    #define cam_CalibrationIlluminant1  1 // Daylight       XXX
1753
1754
1755    // CHDK functionality
1756    #define CAM_CHDK_HAS_EXT_VIDEO_MENU 1   // XXX
1757    #define CAM_EMUL_KEYPRESS_DELAY     40
1758    #define CAM_EMUL_KEYPRESS_DURATION  5
1759    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1760    #undef  DEFAULT_RAW_EXT
1761    #define DEFAULT_RAW_EXT             2   // use .CR2
1762   
1763    #undef  CAM_ADJUSTABLE_ALT_BUTTON
1764    #undef  CAM_CONSOLE_LOG_ENABLED
1765    #undef  CAM_DRAW_EXPOSITION             // XXX
1766    #undef  CAM_FEATURE_FEATHER             // XXX
1767    #undef  CAM_USE_ZOOM_FOR_MF
1768    #undef  CAM_VIDEO_CONTROL               // XXX
1769//----------------------------------------------------------
1770
1771#elif defined (CAMERA_ixus950_sd850)
1772    #define CAM_EXT_TV_RANGE            1
1773    #define CAM_PROPSET                 2
1774
1775    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
1776    #define CAM_RAW_ROWS                2480   // for new 8 MP
1777
1778    #undef  CAM_USE_ZOOM_FOR_MF
1779    #undef  CAM_HAS_ERASE_BUTTON
1780    #undef  CAM_HAS_IRIS_DIAPHRAGM
1781    #define CAM_HAS_ND_FILTER           1
1782    #undef  CAM_HAS_MANUAL_FOCUS
1783    #undef  CAM_HAS_USER_TV_MODES
1784    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1785    #define CAM_MULTIPART               1
1786    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
1787    // pattern
1788    #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
1789    // color
1790    #define CAM_COLORMATRIX1        \
1791      14573, 1, -5482, 1, -1546, 1, \
1792     -1266,  1, 9799,  1, 1468,  1, \
1793     -1040,  1, 1912,  1, 3810,  1
1794
1795    #define cam_CalibrationIlluminant1 1 // Daylight                   
1796    // cropping
1797    #define CAM_JPEG_WIDTH  3264
1798    #define CAM_JPEG_HEIGHT 2448
1799    #define CAM_ACTIVE_AREA_X1 10
1800    #define CAM_ACTIVE_AREA_Y1 8
1801    #define CAM_ACTIVE_AREA_X2 3302
1802    #define CAM_ACTIVE_AREA_Y2 2474
1803    // camera name
1804    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
1805    #define DNG_EXT_FROM ".DPS"
1806//----------------------------------------------------------
1807
1808#elif defined (CAMERA_ixus960_sd950)
1809    #define CAM_PROPSET                 2
1810    #define CAM_DRYOS                   1
1811
1812    #define CAM_RAW_ROWPIX              4104   
1813    #define CAM_RAW_ROWS                3048   
1814
1815    #undef  CAM_USE_ZOOM_FOR_MF
1816    #undef  CAM_HAS_ERASE_BUTTON
1817    #undef  CAM_HAS_IRIS_DIAPHRAGM
1818    #define CAM_HAS_ND_FILTER           1
1819    #undef  CAM_HAS_MANUAL_FOCUS
1820    #undef  CAM_HAS_USER_TV_MODES
1821    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1822    // pattern
1823    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1824    // color
1825    #define CAM_COLORMATRIX1                               \
1826      913762, 1000000, -261578, 1000000, -135582, 1000000, \
1827      -99049, 1000000, 1067089, 1000000,  61442,  1000000, \
1828      48717,  1000000, 96802,   1000000,  412056, 1000000
1829   
1830    #define cam_CalibrationIlluminant1 1 // Daylight
1831    // cropping
1832    #define CAM_JPEG_WIDTH  4000
1833    #define CAM_JPEG_HEIGHT 3000
1834    #define CAM_ACTIVE_AREA_X1 48
1835    #define CAM_ACTIVE_AREA_Y1 12
1836    #define CAM_ACTIVE_AREA_X2 4080
1837    #define CAM_ACTIVE_AREA_Y2 3036
1838    // camera name
1839    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
1840
1841    #define DNG_EXT_FROM ".CR2"
1842//----------------------------------------------------------
1843
1844#elif defined (CAMERA_ixus970_sd890)
1845    #define CAM_PROPSET                 2
1846    #define CAM_DRYOS                   1
1847
1848    #define CAM_RAW_ROWPIX              3720
1849    #define CAM_RAW_ROWS                2772
1850
1851    #undef CAM_USE_ZOOM_FOR_MF
1852    #undef CAM_HAS_ERASE_BUTTON
1853    #undef CAM_HAS_IRIS_DIAPHRAGM
1854    #define CAM_HAS_ND_FILTER           1
1855    #undef CAM_HAS_MANUAL_FOCUS
1856    #define CAM_MULTIPART               1
1857    #define CAM_HAS_JOGDIAL             1
1858    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
1859    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1860    #define CAM_EXT_TV_RANGE            1
1861
1862    // pattern
1863    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
1864
1865    // color
1866    #define CAM_COLORMATRIX1                               \
1867      827547, 1000000, -290458, 1000000, -126086, 1000000, \
1868     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
1869      5181,   1000000, 48183,   1000000, 245014,  1000000
1870    #define cam_CalibrationIlluminant1 1 // Daylight
1871
1872    // cropping
1873    #define CAM_JPEG_WIDTH  3648
1874    #define CAM_JPEG_HEIGHT 2736
1875    #define CAM_ACTIVE_AREA_X1 6
1876    #define CAM_ACTIVE_AREA_Y1 12
1877    #define CAM_ACTIVE_AREA_X2 3690
1878    #define CAM_ACTIVE_AREA_Y2 2772
1879
1880    // camera name
1881    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
1882
1883    // 12 bit support
1884    #undef  CAM_SENSOR_BITS_PER_PIXEL
1885    #undef  CAM_WHITE_LEVEL
1886    #undef  CAM_BLACK_LEVEL
1887    #define CAM_SENSOR_BITS_PER_PIXEL   12
1888    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
1889    #define CAM_BLACK_LEVEL             127
1890    #define  CAM_CHDK_PTP               1 // include CHDK PTP support
1891//----------------------------------------------------------
1892
1893#elif defined (CAMERA_ixus980_sd990)
1894    #define CAM_PROPSET                 2 // all values checked so far match propset 2
1895    #define CAM_DRYOS                   1
1896
1897    #define CAM_RAW_ROWPIX              4480 // 14.7 MP 12bpp
1898    #define CAM_RAW_ROWS                3348   
1899
1900    #undef  CAM_USE_ZOOM_FOR_MF
1901    #undef  CAM_HAS_ERASE_BUTTON
1902    #define CAM_MULTIPART               1
1903    #undef  CAM_HAS_IRIS_DIAPHRAGM
1904    #define CAM_HAS_ND_FILTER           1
1905    #define  CAM_HAS_MANUAL_FOCUS               1
1906    #define  CAM_HAS_USER_TV_MODES              1 //include M/P ? needed to make Tv bracketing work
1907    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
1908    #define CAM_CHDK_HAS_EXT_VIDEO_MENU 1
1909    #undef  CAM_VIDEO_CONTROL
1910    #undef CAM_UNCACHED_BIT  // shut up compiler
1911    #define CAM_UNCACHED_BIT    0x40000000
1912    #undef CAM_BITMAP_PALETTE
1913    #define CAM_BITMAP_PALETTE    2
1914
1915        #undef CAM_BLACK_LEVEL
1916    #define CAM_BLACK_LEVEL             127
1917    #define CAM_HAS_JOGDIAL             1
1918//    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
1919    #define CAM_VIDEO_QUALITY_ONLY          1 
1920    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
1921        #undef CAM_SENSOR_BITS_PER_PIXEL
1922    #define CAM_SENSOR_BITS_PER_PIXEL   12
1923        #undef CAM_WHITE_LEVEL
1924    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
1925
1926    // pattern
1927    #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
1928    // color preliminary
1929    #define CAM_COLORMATRIX1                               \
1930      837237, 1000000, -290137, 1000000, -128156, 1000000, \
1931      -127762, 1000000, 643909, 1000000,  52973,  1000000, \
1932      4446,  1000000, 88354,   1000000,  224246, 1000000
1933   
1934    #define cam_CalibrationIlluminant1 1 // Daylight
1935    // cropping
1936    #define CAM_JPEG_WIDTH  4416
1937    #define CAM_JPEG_HEIGHT 3312
1938    #define CAM_ACTIVE_AREA_X1 12
1939    #define CAM_ACTIVE_AREA_Y1 12
1940    #define CAM_ACTIVE_AREA_X2 4444
1941    #define CAM_ACTIVE_AREA_Y2 3324
1942    // camera name
1943    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData sd990: OK
1944
1945    // copied from DavidBs D10 stuff
1946    #undef CAM_USES_ASPECT_CORRECTION
1947    #undef CAM_USES_ASPECT_YCORRECTION
1948    #define CAM_USES_ASPECT_CORRECTION          1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
1949    #define CAM_USES_ASPECT_YCORRECTION         0  //only uses mappings on x coordinate
1950
1951    #undef ASPECT_XCORRECTION
1952    #define ASPECT_XCORRECTION(x)   ( ((x)<<1) )
1953
1954    // Note color palette affects grids!
1955    #undef ASPECT_GRID_XCORRECTION
1956    #define ASPECT_GRID_XCORRECTION(x)   ( (x) )
1957
1958    #undef ASPECT_GRID_YCORRECTION
1959    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )
1960
1961    #undef ASPECT_VIEWPORT_XCORRECTION
1962    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x)
1963    #undef ASPECT_VIEWPORT_YCORRECTION
1964    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
1965
1966    // Note color palette affects games!
1967        //games mappings
1968        #undef GAMES_SCREEN_WIDTH
1969        #undef GAMES_SCREEN_HEIGHT
1970        #define GAMES_SCREEN_WIDTH              360
1971        #define GAMES_SCREEN_HEIGHT             240
1972        #undef ASPECT_GAMES_XCORRECTION
1973        // 720/360=2 same aspect than grids and viewport but another approach: there is a lot of corrections to do in game's code, and we decide to paint directly on display buffer wirh another resolution
1974        // used by gui.c that configures the draw environment (through new draw_gui function) depending on gui_mode: we have then 360x240 for games (but deformed output:circles are not circles) and 320x240 for
1975        // other modes in perfect aspect ratio 4/3: slightly better visualization: file menus more readable, ...
1976        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
1977        #undef ASPECT_GAMES_YCORRECTION
1978        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
1979
1980   #define CAM_ZEBRA_ASPECT_ADJUST 1
1981
1982//    #define DNG_EXT_FROM ".CR2"
1983//----------------------------------------------------------
1984
1985#elif defined (CAMERA_ixus100_sd780)
1986    #define CAM_PROPSET                 2
1987    #define CAM_DRYOS                   1
1988
1989    #define CAM_RAW_ROWPIX              4080            // 12 MP 12bpp
1990    #define CAM_RAW_ROWS                3048            // VERIFY_SD780 Found RAW #s by searching " CrwAddress %lx, CrwSize H %ld V %ld\r"
1991
1992    #undef  CAM_HAS_ERASE_BUTTON
1993    #undef  CAM_USE_ZOOM_FOR_MF
1994    #define CAM_MULTIPART               1
1995    #undef  CAM_HAS_IRIS_DIAPHRAGM
1996    #define CAM_HAS_ND_FILTER           1
1997
1998    #undef CAM_REMOTE
1999    #undef CAM_SYNCH
2000
2001    #define CAM_HAS_ZOOM_LEVER          1
2002
2003//    #define CAM_CAN_SD_OVER_NOT_IN_MF   1                     // Camera allows subject distance (focus) override when not in manual focus mode
2004//    #define CAM_CAN_SD_OVERRIDE         1                     // Camera allows to do subject distance override
2005
2006    #undef  CAM_HAS_MANUAL_FOCUS
2007    #define CAM_HAS_USER_TV_MODES                 1
2008    #define CAM_SHOW_OSD_IN_SHOOT_MENU            1
2009    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO  1
2010    #define CAM_AF_SCAN_DURING_VIDEO_RECORD       1
2011    #define CAM_CHDK_HAS_EXT_VIDEO_MENU           1
2012
2013    #define CAM_HAS_IS                  1
2014    #undef CAM_HAS_JOGDIAL
2015
2016    #undef  CAM_VIDEO_CONTROL
2017    #define CAM_VIDEO_QUALITY_ONLY      1
2018
2019    #define CAM_EXT_TV_RANGE            1
2020
2021    #undef CAM_UNCACHED_BIT
2022    #define CAM_UNCACHED_BIT            0x40000000
2023
2024    #undef CAM_BITMAP_PALETTE
2025    #define CAM_BITMAP_PALETTE          5
2026
2027    #undef ZEBRA_HMARGIN0
2028    #define ZEBRA_HMARGIN0              150                     //zebra adjust buffer height: show use at sx200is: needed for save memory space
2029
2030    #define CAM_QUALITY_OVERRIDE 1
2031    #undef CAM_SENSOR_BITS_PER_PIXEL
2032    #define CAM_SENSOR_BITS_PER_PIXEL   12
2033    #undef CAM_WHITE_LEVEL
2034    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2035    #undef CAM_BLACK_LEVEL
2036    #define CAM_BLACK_LEVEL             127
2037
2038    // pattern
2039    //RealRom:FFA99FB4                    ADR     R0, aObRG1G2BLdLdLd ; "\n  OB : (R, G1, G2, B) = (%ld, %ld, %ld"...
2040    #define cam_CFAPattern              0x02010100              // Red  Green  Green  Blue
2041
2042    // color preliminary (see DNG4PS2 wiki)
2043    #define CAM_COLORMATRIX1                               \
2044      661840,  1000000, -185671, 1000000, -97110,  1000000, \
2045      -83661,  1000000, 578860, 1000000,   32308,  1000000, \
2046      -8681,    1000000, 70356,   1000000, 207341, 1000000
2047
2048    //Here is an alternate CAM_COLORMATRIX1 - Current one is nice for me but hey I'm no colour expert.
2049    //XYZ -> Camera matrix:
2050    //0.459395 -0.129083 -0.068085
2051    //-0.055837 0.400827 0.020378
2052    //-0.004622 0.048662 0.139970
2053
2054    #define cam_CalibrationIlluminant1  17                      // Standard Light A
2055
2056        // cropping
2057    #define CAM_JPEG_WIDTH              4000
2058    #define CAM_JPEG_HEIGHT             3000
2059    #define CAM_ACTIVE_AREA_X1          40
2060    #define CAM_ACTIVE_AREA_Y1          24
2061    #define CAM_ACTIVE_AREA_X2          4056
2062    #define CAM_ACTIVE_AREA_Y2          3040
2063    // camera name
2064    #define PARAM_CAMERA_NAME           4                       // parameter number for GetParameterData sd990: OK
2065
2066    #undef CAM_USES_ASPECT_CORRECTION
2067    #undef CAM_USES_ASPECT_YCORRECTION
2068    #define CAM_USES_ASPECT_CORRECTION          1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
2069    #define CAM_USES_ASPECT_YCORRECTION         0  //only uses mappings on x coordinate
2070
2071    #undef ASPECT_XCORRECTION
2072    #define ASPECT_XCORRECTION(x)   ( ((x)<<1) )
2073
2074    // Note color palette affects grids!
2075    #undef ASPECT_GRID_XCORRECTION
2076    #define ASPECT_GRID_XCORRECTION(x)   ( (x) )
2077
2078    #undef ASPECT_GRID_YCORRECTION
2079    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )
2080
2081    #undef ASPECT_VIEWPORT_XCORRECTION
2082    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x)
2083    #undef ASPECT_VIEWPORT_YCORRECTION
2084    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
2085
2086    // Note color palette affects games!
2087        //games mappings
2088        #undef GAMES_SCREEN_WIDTH
2089        #undef GAMES_SCREEN_HEIGHT
2090        #define GAMES_SCREEN_WIDTH              360
2091        #define GAMES_SCREEN_HEIGHT             240
2092        #undef ASPECT_GAMES_XCORRECTION
2093        // 720/360=2 same aspect than grids and viewport but another approach: there is a lot of corrections to do in game's code, and we decide to paint directly on display buffer wirh another resolution
2094        // used by gui.c that configures the draw environment (through new draw_gui function) depending on gui_mode: we have then 360x240 for games (but deformed output:circles are not circles) and 320x240 for
2095        // other modes in perfect aspect ratio 4/3: slightly better visualization: file menus more readable, ...
2096        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
2097        #undef ASPECT_GAMES_YCORRECTION
2098        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
2099    #define CAM_ZEBRA_ASPECT_ADJUST 1
2100        // camera has little free memory
2101    #define CAM_ZEBRA_NOBUF 1
2102//----------------------------------------------------------
2103
2104#elif defined (CAMERA_ixus90_sd790)
2105    #define CAM_PROPSET                 2
2106    #define CAM_DRYOS                   1
2107
2108    #define CAM_RAW_ROWPIX              3720
2109    #define CAM_RAW_ROWS                2772
2110
2111    #undef CAM_USE_ZOOM_FOR_MF
2112    #undef CAM_HAS_ERASE_BUTTON
2113    #define CAM_MULTIPART               1
2114    #undef CAM_HAS_IRIS_DIAPHRAGM
2115    #undef CAM_HAS_MANUAL_FOCUS
2116
2117    #define CAM_HAS_ND_FILTER           1
2118    #undef CAM_HAS_USER_TV_MODES
2119    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
2120    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
2121    #define CAM_HAS_JOGDIAL             1
2122    #undef CAM_VIDEO_CONTROL
2123    #define CAM_EXT_TV_RANGE            1          // CHDK can make exposure time longer than 64s
2124
2125    // pattern
2126    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2127    // color
2128    #define CAM_COLORMATRIX1                               \
2129      827547, 1000000, -290458, 1000000, -126086, 1000000, \
2130     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
2131      5181,   1000000, 48183,   1000000, 245014,  1000000
2132    #define cam_CalibrationIlluminant1 1 // Daylight
2133
2134    // cropping
2135    #define CAM_JPEG_WIDTH  3648
2136    #define CAM_JPEG_HEIGHT 2736
2137    #define CAM_ACTIVE_AREA_X1 6
2138    #define CAM_ACTIVE_AREA_Y1 12
2139    #define CAM_ACTIVE_AREA_X2 3690
2140    #define CAM_ACTIVE_AREA_Y2 2772
2141
2142    // camera name
2143    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2144    #undef  CAM_SENSOR_BITS_PER_PIXEL
2145    #undef  CAM_WHITE_LEVEL
2146    #undef  CAM_BLACK_LEVEL
2147    #define CAM_SENSOR_BITS_PER_PIXEL   12
2148    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2149    #define CAM_BLACK_LEVEL             127
2150//----------------------------------------------------------
2151
2152#elif defined (CAMERA_ixus85_sd770)
2153        #define CAM_PROPSET                 2
2154        #define CAM_DRYOS                   1
2155
2156        #define CAM_RAW_ROWPIX              3720
2157        #define CAM_RAW_ROWS                2772
2158
2159        #undef CAM_USE_ZOOM_FOR_MF
2160        #undef CAM_HAS_ERASE_BUTTON
2161        #define CAM_MULTIPART               1
2162        #undef CAM_HAS_IRIS_DIAPHRAGM
2163        #undef CAM_HAS_MANUAL_FOCUS
2164
2165        #define CAM_HAS_ND_FILTER           1
2166        #undef CAM_HAS_USER_TV_MODES
2167        #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
2168         #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
2169        #undef CAM_HAS_JOGDIAL
2170        #undef CAM_VIDEO_CONTROL
2171        #define CAM_EXT_TV_RANGE            1          // CHDK can make exposure time longer than 64s
2172
2173        // pattern
2174        #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2175        // color
2176        #define CAM_COLORMATRIX1                               \
2177      827547, 1000000, -290458, 1000000, -126086, 1000000, \
2178     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
2179      5181,   1000000, 48183,   1000000, 245014,  1000000
2180        #define cam_CalibrationIlluminant1 1 // Daylight
2181
2182        // cropping
2183        #define CAM_JPEG_WIDTH  3648
2184        #define CAM_JPEG_HEIGHT 2736
2185        #define CAM_ACTIVE_AREA_X1 6
2186        #define CAM_ACTIVE_AREA_Y1 12
2187        #define CAM_ACTIVE_AREA_X2 3690
2188        #define CAM_ACTIVE_AREA_Y2 2772
2189
2190        // camera name
2191        #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2192        #undef  CAM_SENSOR_BITS_PER_PIXEL
2193        #undef  CAM_WHITE_LEVEL
2194        #undef  CAM_BLACK_LEVEL
2195        #define CAM_SENSOR_BITS_PER_PIXEL   12
2196        #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2197        #define CAM_BLACK_LEVEL             127
2198//----------------------------------------------------------
2199
2200#elif defined (CAMERA_ixus95_sd1200)
2201        #define CAM_PROPSET                  2
2202        #define CAM_DRYOS                    1
2203
2204        #define CAM_RAW_ROWPIX               3720
2205        #define CAM_RAW_ROWS                 2772
2206
2207        #undef   CAM_HAS_ERASE_BUTTON
2208        #define  CAM_USE_ZOOM_FOR_MF         1
2209        #define  CAM_MULTIPART               1
2210        #undef   CAM_HAS_IRIS_DIAPHRAGM
2211        #define  CAM_HAS_ND_FILTER           1
2212
2213        #undef CAM_SYNCH
2214
2215        #define CAM_HAS_ZOOM_LEVER          1
2216
2217        #undef  CAM_HAS_MANUAL_FOCUS
2218        #define  CAM_HAS_USER_TV_MODES           1
2219        #define  CAM_SHOW_OSD_IN_SHOOT_MENU      1
2220        #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO  1
2221        //#define CAM_AF_SCAN_DURING_VIDEO_RECORD       1
2222        #undef CAM_AF_SCAN_DURING_VIDEO_RECORD          //TODO: change to define and find NSTUB   
2223        #define  CAM_CHDK_HAS_EXT_VIDEO_MENU     1
2224
2225        #define CAM_HAS_IS                                               1
2226        #undef CAM_HAS_JOGDIAL
2227
2228        #undef   CAM_VIDEO_CONTROL
2229        #define  CAM_VIDEO_QUALITY_ONLY                 1
2230
2231        //#define CAM_EXT_TV_RANGE            1
2232
2233        #undef   CAM_UNCACHED_BIT            // shut up compiler
2234        #define  CAM_UNCACHED_BIT            0x40000000
2235
2236        #undef   CAM_BITMAP_PALETTE
2237        #define  CAM_BITMAP_PALETTE          2
2238
2239        #define CAM_QUALITY_OVERRIDE 1 
2240        #undef   CAM_SENSOR_BITS_PER_PIXEL
2241        #define  CAM_SENSOR_BITS_PER_PIXEL   12
2242        #undef   CAM_WHITE_LEVEL
2243        #define  CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2244        #undef   CAM_BLACK_LEVEL
2245        #define  CAM_BLACK_LEVEL             127
2246
2247        // pattern
2248    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2249
2250        // color preliminary
2251        // from para in forum
2252        #define  CAM_COLORMATRIX1                             \
2253    1484685, 1000000, -530958, 1000000, -208054, 1000000, \
2254    143142, 1000000, 793552, 1000000, 83907, 1000000, \
2255    146290, 1000000, -44679, 1000000, 430414, 1000000
2256
2257        #define  cam_CalibrationIlluminant1 1 // Daylight
2258
2259        // cropping
2260        #define  CAM_JPEG_WIDTH  3648
2261        #define  CAM_JPEG_HEIGHT 2736
2262        #define  CAM_ACTIVE_AREA_X1 8
2263        #define  CAM_ACTIVE_AREA_Y1 12
2264        #define  CAM_ACTIVE_AREA_X2 3692
2265        #define  CAM_ACTIVE_AREA_Y2 2772
2266
2267        // camera name
2268        #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2269
2270        // aspect correction
2271    #undef CAM_USES_ASPECT_CORRECTION
2272    #undef CAM_USES_ASPECT_YCORRECTION
2273    #define CAM_USES_ASPECT_CORRECTION          1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
2274    #define CAM_USES_ASPECT_YCORRECTION         0  //only uses mappings on x coordinate
2275
2276    #undef ASPECT_XCORRECTION
2277    #define ASPECT_XCORRECTION(x)   ( ((x)<<1) )
2278
2279    // Note color palette affects grids!
2280    #undef ASPECT_GRID_XCORRECTION
2281    #define ASPECT_GRID_XCORRECTION(x)   ( (x) )
2282
2283    #undef ASPECT_GRID_YCORRECTION
2284    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )
2285
2286    #undef ASPECT_VIEWPORT_XCORRECTION
2287    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x)
2288    #undef ASPECT_VIEWPORT_YCORRECTION
2289    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
2290
2291        //games mappings
2292        #undef GAMES_SCREEN_WIDTH
2293        #undef GAMES_SCREEN_HEIGHT
2294        #define GAMES_SCREEN_WIDTH              360
2295        #define GAMES_SCREEN_HEIGHT             240
2296        #undef ASPECT_GAMES_XCORRECTION
2297        // 720/360=2 same aspect than grids and viewport but another approach: there is a lot of corrections to do in game's code, and we decide to paint directly on display buffer wirh another resolution
2298        // used by gui.c that configures the draw environment (trhough new draw_gui function) depending on gui_mode: we have then 360x240 for games (but deformed output:circles are not circles) and 320x240 for
2299        // other modes in perfect aspect ratio 4/3: slightly better visualization: file menus more readable, ...
2300        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
2301        #undef ASPECT_GAMES_YCORRECTION
2302        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
2303
2304    #define CAM_ZEBRA_ASPECT_ADJUST 1
2305        // camera has very little free memory
2306    #define CAM_ZEBRA_NOBUF 1
2307    #define  CAM_CHDK_PTP               1 // include CHDK PTP support
2308
2309//----------------------------------------------------------
2310
2311
2312//==========================================================
2313// S-Series
2314//==========================================================
2315#elif defined (CAMERA_s2is)
2316    #define CAM_PROPSET                 1
2317
2318    #define CAM_RAW_ROWPIX              2672   // for 5 MP
2319    #define CAM_RAW_ROWS                1968   // for 5 MP
2320
2321    #undef  CAM_SYNCH   
2322    #define CAM_SWIVEL_SCREEN           1
2323    #define CAM_ADJUSTABLE_ALT_BUTTON   1
2324    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
2325    #define  CAM_HAS_VIDEO_BUTTON       1
2326    #undef  CAM_VIDEO_CONTROL
2327    // pattern
2328    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2329    // color
2330    #define CAM_COLORMATRIX1                                \
2331      547708,  1000000, -143462, 1000000,  -99243, 1000000, \
2332     -186838,  1000000, 663925,  1000000,   50970, 1000000, \
2333     -5810,    1000000, 79162,   1000000,  266988, 1000000
2334
2335    #define cam_CalibrationIlluminant1 1 // Daylight
2336    // cropping
2337    #define CAM_JPEG_WIDTH  2592
2338    #define CAM_JPEG_HEIGHT 1944
2339    #define CAM_ACTIVE_AREA_X1 14
2340    #define CAM_ACTIVE_AREA_Y1 10
2341    #define CAM_ACTIVE_AREA_X2 2626
2342    #define CAM_ACTIVE_AREA_Y2 1966
2343    // camera name
2344    #define PARAM_CAMERA_NAME 2 // parameter number for GetParameterData
2345    #define CAM_BRACKETING              1
2346    #define DNG_EXT_FROM ".DPS"
2347//----------------------------------------------------------
2348
2349#elif defined (CAMERA_s3is)
2350    #define CAM_PROPSET                 1
2351
2352    #define CAM_RAW_ROWPIX              2888   // for 6 MP
2353    #define CAM_RAW_ROWS                2136   // for 6 MP
2354   
2355    #undef  CAM_SYNCH 
2356    #define CAM_SWIVEL_SCREEN           1
2357    #define CAM_ADJUSTABLE_ALT_BUTTON   1
2358    #define CAM_MULTIPART               1
2359    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
2360    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
2361    #define  CAM_HAS_VIDEO_BUTTON       1
2362    // pattern
2363    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2364    // color
2365    #define CAM_COLORMATRIX1                               \
2366     14062, 10000, -5199, 10000, -1446, 10000,             \
2367     -4712, 10000, 12470, 10000,  2243, 10000,             \
2368     -1286, 10000,  2028, 10000,  4836, 10000
2369   
2370    #define cam_CalibrationIlluminant1 17 // Standard light A
2371    // cropping
2372    #define CAM_JPEG_WIDTH  2816
2373    #define CAM_JPEG_HEIGHT 2112
2374    #define CAM_ACTIVE_AREA_X1 44
2375    #define CAM_ACTIVE_AREA_Y1 8
2376    #define CAM_ACTIVE_AREA_X2 2884
2377    #define CAM_ACTIVE_AREA_Y2 2136
2378    // camera name
2379    #define PARAM_CAMERA_NAME 3 // parameter number for GetParameterData
2380    #define CAM_BRACKETING              1
2381    #define DNG_EXT_FROM ".DPS"
2382
2383    #define CAM_EXT_TV_RANGE            1
2384//----------------------------------------------------------
2385
2386#elif defined (CAMERA_s5is)
2387    #define CAM_PROPSET                 2
2388    #define CAM_DRYOS                   1
2389
2390    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
2391    #define CAM_RAW_ROWS                2480   // for new 8 MP
2392   
2393    #define CAM_SWIVEL_SCREEN           1
2394    #define CAM_ADJUSTABLE_ALT_BUTTON   1
2395    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
2396    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
2397    #define CAM_HAS_VIDEO_BUTTON       1
2398    #define CAM_EXT_TV_RANGE            1
2399    // pattern
2400    #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
2401    // color
2402    #define CAM_COLORMATRIX1                               \
2403      650591, 1000000, -199585, 1000000, -123118, 1000000, \
2404     -69617,  1000000, 583926,  1000000,  34354,  1000000, \
2405     -19113,  1000000, 82163,   1000000, 210786,  1000000
2406   
2407    #define cam_CalibrationIlluminant1 1 // Daylight
2408    // cropping
2409    #define CAM_JPEG_WIDTH  3264
2410    #define CAM_JPEG_HEIGHT 2448
2411    #define CAM_ACTIVE_AREA_X1 10
2412    #define CAM_ACTIVE_AREA_Y1 8
2413    #define CAM_ACTIVE_AREA_X2 3302
2414    #define CAM_ACTIVE_AREA_Y2 2474
2415    // camera name
2416    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2417    #define CAM_BRACKETING              1
2418    #define DNG_EXT_FROM ".DPS"
2419    #define  CAM_CHDK_PTP               1 // include CHDK PTP support
2420//----------------------------------------------------------
2421
2422
2423//==========================================================
2424// TX-Series
2425//==========================================================
2426#elif defined (CAMERA_tx1)
2427    #define CAM_PROPSET                 2
2428   
2429    #define CAM_RAW_ROWPIX              3152   // for 7 MP
2430    #define CAM_RAW_ROWS                2340   // for 7 MP
2431
2432    #define CAM_SWIVEL_SCREEN           1
2433    #define CAM_HAS_ND_FILTER           1
2434    #undef  CAM_HAS_ERASE_BUTTON
2435    #undef  CAM_HAS_MANUAL_FOCUS
2436    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
2437    #define CAM_MULTIPART               1
2438    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
2439    #define  CAM_HAS_VIDEO_BUTTON       1
2440    // pattern
2441    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2442    // color
2443    #define CAM_COLORMATRIX1                                \
2444      510370,  1000000, -68998,  1000000, -86859,  1000000, \
2445      -279980, 1000000, 766686,  1000000,  67944,  1000000, \
2446      -14382,  1000000, 113688,  1000000, 239853,  1000000
2447   
2448    #define cam_CalibrationIlluminant1 1 // Daylight
2449    // cropping
2450    #define CAM_JPEG_WIDTH  3072
2451    #define CAM_JPEG_HEIGHT 2304
2452    #define CAM_ACTIVE_AREA_X1 12
2453    #define CAM_ACTIVE_AREA_Y1 8
2454    #define CAM_ACTIVE_AREA_X2 3108
2455    #define CAM_ACTIVE_AREA_Y2 2332
2456    // camera name
2457    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2458    #define DNG_EXT_FROM ".DPS"
2459//----------------------------------------------------------
2460
2461
2462//==========================================================
2463// SX-Series
2464//==========================================================
2465#elif defined (CAMERA_sx100is)
2466    #define CAM_PROPSET                 2
2467    #define CAM_DRYOS                   1
2468
2469    #define CAM_RAW_ROWPIX              3336   // for new 8 MP
2470    #define CAM_RAW_ROWS                2480   // for new 8 MP
2471    #undef CAM_SYNCH
2472    #define CAM_CAN_MUTE_MICROPHONE     1
2473    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
2474    #define CAM_ADJUSTABLE_ALT_BUTTON   1
2475    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
2476    #undef  CAM_VIDEO_CONTROL
2477    #define CAM_REAR_CURTAIN            1
2478    #define CAM_HAS_JOGDIAL             1
2479    // pattern
2480    #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
2481    // color
2482    #define CAM_COLORMATRIX1                               \
2483      656793, 1000000, -168702, 1000000, -108030, 1000000, \
2484      -2711,  1000000, 661538,  1000000,  37919,  1000000, \
2485      77255,  1000000, 48834,   1000000, 241797,  1000000
2486   
2487    #define cam_CalibrationIlluminant1 1 // Daylight
2488    // cropping
2489    #define CAM_JPEG_WIDTH  3264
2490    #define CAM_JPEG_HEIGHT 2448
2491    #define CAM_ACTIVE_AREA_X1 10
2492    #define CAM_ACTIVE_AREA_Y1 8
2493    #define CAM_ACTIVE_AREA_X2 3302
2494    #define CAM_ACTIVE_AREA_Y2 2474
2495    // camera name
2496    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2497
2498    #define DNG_EXT_FROM ".CR2"
2499    #define CAM_MULTIPART               1
2500//----------------------------------------------------------
2501
2502#elif defined (CAMERA_sx10)
2503    #define CAM_PROPSET                 2
2504    #define CAM_DRYOS                   1
2505
2506    #define CAM_RAW_ROWPIX              3720   
2507    #define CAM_RAW_ROWS                2772   
2508
2509    #define CAM_SWIVEL_SCREEN           1
2510    #define CAM_ADJUSTABLE_ALT_BUTTON   1
2511    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
2512    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
2513    #define CAM_HAS_VIDEO_BUTTON       1
2514    #define CAM_VIDEO_QUALITY_ONLY          1 
2515    #define CAM_BRACKETING              1
2516    #undef  CAM_VIDEO_CONTROL
2517    #define CAM_MULTIPART               1
2518    #define CAM_HAS_JOGDIAL             1
2519    #undef  CAM_USE_ZOOM_FOR_MF
2520    #undef  CAM_UNCACHED_BIT  // shut up compiler
2521    #define CAM_UNCACHED_BIT    0x40000000
2522
2523    // pattern
2524    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2525    // color
2526
2527    #define CAM_COLORMATRIX1                               \
2528      827547, 1000000, -290458, 1000000, -126086, 1000000, \
2529     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
2530      5181,   1000000, 48183,   1000000, 245014,  1000000
2531
2532    #define cam_CalibrationIlluminant1 1 // Daylight
2533    // cropping
2534    #define CAM_JPEG_WIDTH  3648
2535    #define CAM_JPEG_HEIGHT 2736
2536    #define CAM_ACTIVE_AREA_X1 6
2537    #define CAM_ACTIVE_AREA_Y1 12
2538    #define CAM_ACTIVE_AREA_X2 3690
2539    #define CAM_ACTIVE_AREA_Y2 2772
2540    // camera name
2541    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2542    #undef  CAM_SENSOR_BITS_PER_PIXEL
2543    #undef  CAM_WHITE_LEVEL
2544    #undef  CAM_BLACK_LEVEL
2545    #define CAM_SENSOR_BITS_PER_PIXEL   12
2546    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2547    #define CAM_BLACK_LEVEL             127
2548
2549    #define CAM_EXT_TV_RANGE            1
2550//----------------------------------------------------------
2551
2552#elif defined (CAMERA_sx1)
2553    #define CAM_PROPSET                 2
2554    #define CAM_DRYOS                   1
2555
2556    #define CAM_RAW_ROWPIX              4152
2557    #define CAM_RAW_ROWS                2772 
2558
2559    #define CAM_SWIVEL_SCREEN           1
2560    #define CAM_ADJUSTABLE_ALT_BUTTON   1
2561    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
2562    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
2563    #define CAM_HAS_VIDEO_BUTTON       1
2564    #define CAM_VIDEO_QUALITY_ONLY          1 
2565    #define CAM_BRACKETING              1
2566    #undef  CAM_VIDEO_CONTROL
2567    #define CAM_MULTIPART               1
2568    #define CAM_HAS_JOGDIAL             1
2569    #undef  CAM_USE_ZOOM_FOR_MF
2570    #undef  CAM_UNCACHED_BIT  // shut up compiler
2571    #define CAM_UNCACHED_BIT    0x40000000
2572
2573    // pattern
2574    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2575    // color
2576
2577    #define CAM_COLORMATRIX1                               \
2578      827547, 1000000, -290458, 1000000, -126086, 1000000, \
2579     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
2580      5181,   1000000, 48183,   1000000, 245014,  1000000
2581
2582    #define cam_CalibrationIlluminant1 1 // Daylight
2583    // cropping
2584    #define CAM_JPEG_WIDTH  3648
2585    #define CAM_JPEG_HEIGHT 2736
2586    #define CAM_ACTIVE_AREA_X1 344
2587    #define CAM_ACTIVE_AREA_Y1 24
2588    #define CAM_ACTIVE_AREA_X2 3991
2589    #define CAM_ACTIVE_AREA_Y2 2759 
2590    // camera name
2591    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2592    #undef  CAM_SENSOR_BITS_PER_PIXEL
2593    #undef  CAM_WHITE_LEVEL
2594    #undef  CAM_BLACK_LEVEL
2595    #define CAM_SENSOR_BITS_PER_PIXEL   12
2596    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2597    #define CAM_BLACK_LEVEL             127
2598 
2599    #define CAM_EXT_TV_RANGE            1
2600 
2601    #define CAM_HAS_VARIABLE_ASPECT 1
2602//----------------------------------------------------------
2603
2604        //********
2605        /////SX110
2606        //********
2607#elif defined (CAMERA_sx110is)
2608        #define CAM_COLORMATRIX1                               \
2609      530200, 1000000, -42600,  1000000, -33000,  1000000, \
2610     -525400,  1000000, 1092700,  1000000,  223700,  1000000, \
2611     -103700,  1000000, 117900,   1000000,  421600,  1000000
2612    #define CAM_ACTIVE_AREA_X1 8
2613    #define CAM_ACTIVE_AREA_Y1 14
2614    #define CAM_ACTIVE_AREA_X2 3688
2615    #define CAM_ACTIVE_AREA_Y2 2772
2616
2617    #define CAM_PROPSET                 2
2618    #define CAM_DRYOS                   1
2619    #define CAM_RAW_ROWPIX              3720 
2620    #define CAM_RAW_ROWS                2772 
2621    #undef CAM_SYNCH
2622    #define CAM_CAN_MUTE_MICROPHONE     1
2623    #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
2624    #define CAM_REAR_CURTAIN            1
2625    #define CAM_ADJUSTABLE_ALT_BUTTON   1
2626    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
2627    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
2628    #undef  CAM_VIDEO_CONTROL
2629    #define CAM_MULTIPART               1
2630    #define CAM_HAS_JOGDIAL             1
2631    #undef  CAM_USE_ZOOM_FOR_MF
2632        #undef CAM_SENSOR_BITS_PER_PIXEL
2633    #define CAM_SENSOR_BITS_PER_PIXEL   12
2634        #undef CAM_WHITE_LEVEL
2635    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2636        // black level set to 128 per reports on the forum
2637    #undef  CAM_BLACK_LEVEL
2638    #define CAM_BLACK_LEVEL             128
2639    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2640    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2641    #define cam_CalibrationIlluminant1 1 // Daylight
2642    #define CAM_JPEG_WIDTH  3456
2643    #define CAM_JPEG_HEIGHT 2592
2644//----------------------------------------------------------
2645
2646        //********
2647        /////SX200
2648        //********
2649#elif defined (CAMERA_sx200is)
2650    // copied from SX10 and modified
2651    #define CAM_PROPSET                 2
2652    #define CAM_DRYOS                   1
2653    #define CAM_RAW_ROWPIX              4080 // from calcs see 100C lib.c
2654    #define CAM_RAW_ROWS                3048 //  "     "    "    "    " 
2655   
2656    #undef  CAM_CAN_SD_OVER_NOT_IN_MF
2657    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
2658    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
2659
2660    #define CAM_VIDEO_QUALITY_ONLY          1 
2661
2662    #undef  CAM_VIDEO_CONTROL
2663    #define CAM_MULTIPART               1
2664    #define CAM_HAS_JOGDIAL             1
2665    #undef  CAM_USE_ZOOM_FOR_MF
2666    #undef  CAM_UNCACHED_BIT  // shut up compiler
2667    #define CAM_UNCACHED_BIT    0x40000000
2668    // pattern
2669    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2670    // color
2671    //need fixing *****************************************************
2672    #define CAM_COLORMATRIX1                               \
2673      14134, 1000000, -5576, 1000000, -1527, 1000000, \
2674     -1991,  1000000, 10719,  1000000, 1273,   1000000, \
2675      -1158,   1000000, 1929,   1000000, 3581,  1000000
2676
2677    #define cam_CalibrationIlluminant1 17 // Standard Light A
2678    // cropping
2679    #define CAM_JPEG_WIDTH  4000
2680    #define CAM_JPEG_HEIGHT 3000
2681    #define CAM_ACTIVE_AREA_X1 52
2682    #define CAM_ACTIVE_AREA_Y1 14
2683    #define CAM_ACTIVE_AREA_X2 4052
2684    #define CAM_ACTIVE_AREA_Y2 3014
2685    // camera name
2686    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2687    #undef  CAM_SENSOR_BITS_PER_PIXEL
2688    #undef  CAM_WHITE_LEVEL
2689    #undef  CAM_BLACK_LEVEL
2690    #define CAM_SENSOR_BITS_PER_PIXEL   12
2691    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2692    #define CAM_BLACK_LEVEL             127
2693
2694    #define CAM_EXT_TV_RANGE            1
2695    #undef CAM_BITMAP_PALETTE
2696    #define CAM_BITMAP_PALETTE    3
2697    #undef CAM_HAS_ERASE_BUTTON
2698    #define  CAM_SHOW_OSD_IN_SHOOT_MENU  1
2699       
2700    //nandoide sept-2009
2701    #undef CAM_USES_ASPECT_CORRECTION   
2702    #undef CAM_USES_ASPECT_YCORRECTION 
2703    #define CAM_USES_ASPECT_CORRECTION  1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
2704    #define CAM_USES_ASPECT_YCORRECTION  0  //only uses mappings on x coordinate
2705
2706// reyalp TODO not sure this stuff belongs in camera.h there will probably only be a few different setups
2707// maybe we can just have one CAM_ options that picks what to use ?
2708// values need to be better documented
2709        // reyalp - I guess these are bitmap ?
2710    //default mappings
2711    #undef ASPECT_XCORRECTION
2712    #define ASPECT_XCORRECTION(x)  ( ( ((x)<<3) + (x) )  >>2 )   //correction x*screen_buffer_width/screen_width = x*720/320 = x*9/4 = (x<<3 + x)>>2
2713   
2714    //grids
2715    #undef ASPECT_GRID_XCORRECTION
2716    #define ASPECT_GRID_XCORRECTION(x)  ( ((x)<<3)/9  )  //grids are designed on a 360x240 basis and screen is 320x240, we need x*320/360=x*8/9
2717    #undef ASPECT_GRID_YCORRECTION
2718    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )       //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.
2719   
2720    //viewport
2721    #undef ASPECT_VIEWPORT_XCORRECTION
2722    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
2723    #undef ASPECT_VIEWPORT_YCORRECTION
2724    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
2725    #undef EDGE_HMARGIN
2726    #define EDGE_HMARGIN 28
2727   
2728    //games mappings
2729   #undef GAMES_SCREEN_WIDTH
2730   #undef GAMES_SCREEN_HEIGHT
2731   #define GAMES_SCREEN_WIDTH 360
2732   #define GAMES_SCREEN_HEIGHT 240
2733   #undef ASPECT_GAMES_XCORRECTION
2734   // 720/360=2 same aspect than grids and viewport but another approach: there is a lot of corrections to do in game's code, and we decide to paint directly on display buffer wirh another resolution
2735   // used by gui.c that configures the draw environment (through new draw_gui function) depending on gui_mode: we have then 360x240 for games (but deformed output:circles are not circles) and 320x240 for
2736   // other modes in perfect aspect ratio 4/3: slightly better visualization: file menus more readable, ...
2737   #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) ) 
2738   #undef ASPECT_GAMES_YCORRECTION
2739   #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
2740
2741   //zebra letterbox for saving memory
2742   #undef ZEBRA_HMARGIN0
2743   #define ZEBRA_HMARGIN0  30 //this 30 rows are not used by the display buffer is 720x240 effective, no 960x270, i.e. (270-240) reduction in widht possible but not done (more difficult to manage it and slower).
2744
2745   //end nandoide sept-2009
2746   #define CAM_QUALITY_OVERRIDE 1
2747   #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
2748   #define CAM_ZEBRA_ASPECT_ADJUST 1
2749    #define  CAM_CHDK_PTP               1 // include CHDK PTP support
2750//----------------------------------------------------------
2751
2752#elif defined (CAMERA_g11)
2753    #define CAM_DRYOS_2_3_R39                   1
2754    #define CAM_PROPSET                 3
2755    #define CAM_DRYOS                   1
2756    #undef  CAM_USE_ZOOM_FOR_MF
2757    #define CAM_RAW_ROWPIX              3744   // See g11 lib.c
2758    #define CAM_RAW_ROWS                2784   // See g11 lib.c
2759    #undef  CAM_EMUL_KEYPRESS_DURATION
2760    #define CAM_EMUL_KEYPRESS_DURATION  10
2761
2762    #undef CAM_MENU_BORDERWIDTH
2763    #define CAM_MENU_BORDERWIDTH        10
2764
2765        #define CAM_QUALITY_OVERRIDE 1
2766    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
2767    #define CAM_HAS_JOGDIAL             1
2768    #undef  CAM_CONSOLE_LOG_ENABLED         // Development: internal camera stdout -> A/stdout.txt
2769    #define CAM_BRACKETING              1
2770    #define CAM_MULTIPART               1
2771    #define CAM_EXT_TV_RANGE            1
2772    #undef OPT_CURVES
2773    #undef CAM_UNCACHED_BIT
2774    #define CAM_UNCACHED_BIT            0x40000000  // G11 @FF888204(via ExMem.FreeCacheable)
2775
2776        #define CAM_SWIVEL_SCREEN                       1
2777        #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
2778
2779    // camera name
2780    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2781    #undef  CAM_SENSOR_BITS_PER_PIXEL
2782    #undef  CAM_WHITE_LEVEL
2783    #undef  CAM_BLACK_LEVEL
2784    #define CAM_SENSOR_BITS_PER_PIXEL   12
2785    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2786    #define CAM_BLACK_LEVEL             127
2787
2788    #undef CAM_USES_ASPECT_CORRECTION   
2789    #undef CAM_USES_ASPECT_YCORRECTION 
2790    #define CAM_USES_ASPECT_CORRECTION  1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
2791    #define CAM_USES_ASPECT_YCORRECTION  0  //only uses mappings on x coordinate
2792    //games mappings
2793        #undef GAMES_SCREEN_WIDTH
2794        #undef GAMES_SCREEN_HEIGHT
2795        #define GAMES_SCREEN_WIDTH 360
2796        #define GAMES_SCREEN_HEIGHT 240
2797
2798    #undef CAM_BITMAP_PALETTE
2799    #define CAM_BITMAP_PALETTE    4
2800
2801
2802    #undef ASPECT_XCORRECTION
2803        #define ASPECT_XCORRECTION(x)  ( ( ((x)<<3) + (x) )  >>2 )
2804        #undef ASPECT_GAMES_XCORRECTION
2805        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) ) 
2806        #undef ASPECT_GAMES_YCORRECTION
2807        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
2808
2809    #undef ASPECT_GRID_XCORRECTION
2810    #define ASPECT_GRID_XCORRECTION(x)  ( ((x)<<3)/9  )  //grids are designed on a 360x240 basis and screen is 320x240, we need x*320/360=x*8/9
2811    #undef ASPECT_GRID_YCORRECTION
2812    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )       //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.
2813
2814    #undef ASPECT_VIEWPORT_XCORRECTION
2815    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
2816    #undef ASPECT_VIEWPORT_YCORRECTION
2817    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
2818    #undef EDGE_HMARGIN
2819    #define EDGE_HMARGIN 28
2820
2821        /**** From SX200IS, ok for G11 ?*/
2822    // pattern
2823    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2824    // color
2825    //need fixing *****************************************************
2826    #define CAM_COLORMATRIX1                               \
2827      14134, 1000000, -5576, 1000000, -1527, 1000000, \
2828     -1991,  1000000, 10719,  1000000, 1273,   1000000, \
2829      -1158,   1000000, 1929,   1000000, 3581,  1000000
2830    #define cam_CalibrationIlluminant1 17 // Standard Light A
2831
2832    // cropping
2833        //g11 values from Amit Talwar
2834    #define CAM_JPEG_WIDTH  3648
2835    #define CAM_JPEG_HEIGHT 2736
2836    #define CAM_ACTIVE_AREA_X1 16
2837    #define CAM_ACTIVE_AREA_Y1 8
2838    #define CAM_ACTIVE_AREA_X2 3692
2839    #define CAM_ACTIVE_AREA_Y2 2776
2840       
2841          /**** From SX200IS, ok for G11 END?*/
2842   #define CAM_ZEBRA_ASPECT_ADJUST 1
2843//----------------------------------------------------------
2844
2845#elif defined (CAMERA_s90)
2846    #define CAM_DRYOS_2_3_R39                   1
2847    #define CAM_PROPSET                 3
2848    #define CAM_DRYOS                   1
2849    #undef  CAM_USE_ZOOM_FOR_MF
2850    #define CAM_RAW_ROWPIX              3744   // See g11 lib.c
2851    #define CAM_RAW_ROWS                2784   // See g11 lib.c
2852    #undef  CAM_EMUL_KEYPRESS_DURATION
2853    #define CAM_EMUL_KEYPRESS_DURATION  10
2854
2855    #undef CAM_MENU_BORDERWIDTH
2856    #define CAM_MENU_BORDERWIDTH        10
2857
2858        #define CAM_QUALITY_OVERRIDE 1
2859    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
2860    #define CAM_HAS_JOGDIAL             1
2861        #undef CAM_HAS_ERASE_BUTTON
2862    #undef  CAM_CONSOLE_LOG_ENABLED         // Development: internal camera stdout -> A/stdout.txt
2863    #define CAM_BRACKETING              1
2864    #define CAM_MULTIPART               1
2865    #define CAM_EXT_TV_RANGE            1
2866    #undef OPT_CURVES
2867    #undef CAM_UNCACHED_BIT
2868    #define CAM_UNCACHED_BIT            0x40000000  // S90 @FF8875FC(via ExMem.FreeCacheable)
2869
2870        #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
2871
2872    // camera name
2873    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
2874    #undef  CAM_SENSOR_BITS_PER_PIXEL
2875    #undef  CAM_WHITE_LEVEL
2876    #undef  CAM_BLACK_LEVEL
2877    #define CAM_SENSOR_BITS_PER_PIXEL   12
2878    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2879    #define CAM_BLACK_LEVEL             127
2880
2881    #undef CAM_USES_ASPECT_CORRECTION   
2882    #undef CAM_USES_ASPECT_YCORRECTION 
2883    #define CAM_USES_ASPECT_CORRECTION  1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
2884    #define CAM_USES_ASPECT_YCORRECTION  0  //only uses mappings on x coordinate
2885    //games mappings
2886        #undef GAMES_SCREEN_WIDTH
2887        #undef GAMES_SCREEN_HEIGHT
2888        #define GAMES_SCREEN_WIDTH 360
2889        #define GAMES_SCREEN_HEIGHT 240
2890
2891    #undef CAM_BITMAP_PALETTE
2892    #define CAM_BITMAP_PALETTE    4
2893
2894    #undef ASPECT_XCORRECTION
2895        #define ASPECT_XCORRECTION(x)  ( ( ((x)<<3) + (x) )  >>2 )
2896        #undef ASPECT_GAMES_XCORRECTION
2897        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) ) 
2898        #undef ASPECT_GAMES_YCORRECTION
2899        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
2900
2901    #undef ASPECT_GRID_XCORRECTION
2902    #define ASPECT_GRID_XCORRECTION(x)  ( ((x)<<3)/9  )  //grids are designed on a 360x240 basis and screen is 320x240, we need x*320/360=x*8/9
2903    #undef ASPECT_GRID_YCORRECTION
2904    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )       //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.
2905
2906    #undef ASPECT_VIEWPORT_XCORRECTION
2907    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
2908    #undef ASPECT_VIEWPORT_YCORRECTION
2909    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
2910    #undef EDGE_HMARGIN
2911    #define EDGE_HMARGIN 28
2912
2913        /**** From SX200IS, ok for S90 ?*/
2914    // pattern
2915    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2916    // color
2917    //need fixing *****************************************************
2918    #define CAM_COLORMATRIX1                               \
2919      14134, 1000000, -5576, 1000000, -1527, 1000000, \
2920     -1991,  1000000, 10719,  1000000, 1273,   1000000, \
2921      -1158,   1000000, 1929,   1000000, 3581,  1000000
2922    #define cam_CalibrationIlluminant1 17 // Standard Light A
2923
2924    // cropping -> G11
2925    #define CAM_JPEG_WIDTH              3648
2926    #define CAM_JPEG_HEIGHT             2736
2927    #define CAM_ACTIVE_AREA_X1          16
2928    #define CAM_ACTIVE_AREA_Y1          8
2929    #define CAM_ACTIVE_AREA_X2          3692
2930    #define CAM_ACTIVE_AREA_Y2          2776
2931    /**** From SX200IS, ok for S90 END?*/
2932
2933   #define CAM_ZEBRA_ASPECT_ADJUST 1
2934//----------------------------------------------------------
2935
2936#elif defined (CAMERA_sx20)
2937        #define CAM_PROPSET                                     3
2938        #define CAM_DRYOS                                       1
2939        #define CAM_DRYOS_2_3_R39                       1
2940
2941        #define CAM_RAW_ROWPIX                          4080
2942        #define CAM_RAW_ROWS                            3048
2943
2944        #define CAM_SWIVEL_SCREEN                       1
2945        #define CAM_ADJUSTABLE_ALT_BUTTON       1
2946        #undef  CAM_CAN_SD_OVER_NOT_IN_MF
2947        #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
2948        #define CAM_HAS_VIDEO_BUTTON            1
2949        #define CAM_VIDEO_QUALITY_ONLY          1
2950        #define CAM_BRACKETING                          1
2951        #undef  CAM_VIDEO_CONTROL
2952        #define CAM_MULTIPART                           1
2953        #define CAM_HAS_JOGDIAL                         1
2954        #undef  CAM_USE_ZOOM_FOR_MF
2955        #undef  CAM_UNCACHED_BIT                        // shut up compiler
2956        #define CAM_UNCACHED_BIT                        0x40000000
2957
2958        // pattern
2959        #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
2960        // color
2961
2962        #define CAM_COLORMATRIX1                               \
2963      827547, 1000000, -290458, 1000000, -126086, 1000000, \
2964      -12829, 1000000,  530507, 1000000,   50537, 1000000, \
2965        5181, 1000000,   48183, 1000000,  245014, 1000000
2966
2967        #define cam_CalibrationIlluminant1      1 // Daylight
2968        // cropping
2969        #define CAM_JPEG_WIDTH                          4000
2970        #define CAM_JPEG_HEIGHT                         3000
2971        #define CAM_ACTIVE_AREA_X1                      24
2972        #define CAM_ACTIVE_AREA_Y1                      12
2973        #define CAM_ACTIVE_AREA_X2                      4080-48
2974        #define CAM_ACTIVE_AREA_Y2                      3048-24
2975        // camera name
2976        #define PARAM_CAMERA_NAME                       4 // parameter number for GetParameterData
2977        #undef  CAM_SENSOR_BITS_PER_PIXEL
2978        #undef  CAM_WHITE_LEVEL
2979        #undef  CAM_BLACK_LEVEL
2980        #define CAM_SENSOR_BITS_PER_PIXEL       12
2981        #define CAM_WHITE_LEVEL                         ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
2982        #define CAM_BLACK_LEVEL                         127
2983
2984        #define CAM_EXT_TV_RANGE                        1
2985        #define CAM_QUALITY_OVERRIDE            1
2986
2987        // copied from the SX200 which has the same video buffer size
2988        #undef CAM_USES_ASPECT_CORRECTION
2989        #undef CAM_USES_ASPECT_YCORRECTION
2990        #define CAM_USES_ASPECT_CORRECTION              1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
2991        #define CAM_USES_ASPECT_YCORRECTION             0  //only uses mappings on x coordinate
2992
2993        #undef ASPECT_XCORRECTION
2994        #define ASPECT_XCORRECTION(x)  ( ( ((x)<<3) + (x) )  >>2 )  //correction x*screen_buffer_width/screen_width = x*720/320 = x*9/4 = (x<<3 + x)>>2
2995
2996        #undef ASPECT_GRID_XCORRECTION
2997        #define ASPECT_GRID_XCORRECTION(x)  ( ((x)<<3)/9  )  //grids are designed on a 360x240 basis and screen is 320x240, we need x*320/360=x*8/9
2998        #undef ASPECT_GRID_YCORRECTION
2999    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )  //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.
3000
3001        #undef ASPECT_VIEWPORT_XCORRECTION
3002        #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
3003        #undef ASPECT_VIEWPORT_YCORRECTION
3004        #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
3005
3006        //games mappings
3007        #undef GAMES_SCREEN_WIDTH
3008        #undef GAMES_SCREEN_HEIGHT
3009        #define GAMES_SCREEN_WIDTH              360
3010        #define GAMES_SCREEN_HEIGHT             240
3011        #undef ASPECT_GAMES_XCORRECTION
3012        // 720/360=2 same aspect than grids and viewport but another approach: there is a lot of corrections to do in game's code, and we decide to paint directly on display buffer wirh another resolution
3013        // used by gui.c that configures the draw environment (trhough new draw_gui function) depending on gui_mode: we have then 360x240 for games (but deformed output:circles are not circles) and 320x240 for
3014        // other modes in perfect aspect ratio 4/3: slightly better visualization: file menus more readable, ...
3015        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
3016        #undef ASPECT_GAMES_YCORRECTION
3017        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
3018
3019    #define CAM_ZEBRA_ASPECT_ADJUST 1
3020    #define CAM_ZEBRA_NOBUF 1
3021
3022        #undef CAM_BITMAP_PALETTE
3023        #define CAM_BITMAP_PALETTE              6
3024
3025   //zebra letterbox for saving memory
3026   #undef ZEBRA_HMARGIN0
3027   #define ZEBRA_HMARGIN0  30 //this 30 rows are not used by the display buffer is 720x240 effective, no 960x270, i.e. (270-240) reduction in widht possible but not done (more difficult to manage it and slower).
3028 
3029   #undef EDGE_HMARGIN
3030   #define EDGE_HMARGIN 28
3031   #define CAM_CHDK_PTP 1
3032//----------------------------------------------------------
3033
3034#elif defined (CAMERA_s95)
3035    #define CAM_DRYOS_2_3_R39                   1
3036    #define CAM_PROPSET                 4
3037    #define CAM_DRYOS                   1
3038    #undef  CAM_USE_ZOOM_FOR_MF
3039    #define CAM_RAW_ROWPIX              3744
3040    #define CAM_RAW_ROWS                2784
3041    #undef  CAM_EMUL_KEYPRESS_DURATION
3042    #define CAM_EMUL_KEYPRESS_DURATION  10
3043    #undef CAM_MENU_BORDERWIDTH
3044    #define CAM_MENU_BORDERWIDTH        10
3045        #define CAM_QUALITY_OVERRIDE 1
3046    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
3047    #define CAM_HAS_JOGDIAL             1
3048        #undef CAM_HAS_ERASE_BUTTON
3049    #undef  CAM_CONSOLE_LOG_ENABLED         // Development: internal camera stdout -> A/stdout.txt
3050    #define CAM_BRACKETING              1
3051        #undef  CAM_VIDEO_CONTROL
3052        #define CAM_VIDEO_QUALITY_ONLY          1
3053    #define CAM_MULTIPART               1
3054    #define CAM_EXT_TV_RANGE            1
3055    #undef OPT_CURVES
3056    #undef CAM_UNCACHED_BIT
3057    #define CAM_UNCACHED_BIT            0x40000000  // S94 100E @FF89100C
3058        #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
3059
3060    // camera name
3061    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
3062    #undef  CAM_SENSOR_BITS_PER_PIXEL
3063    #define CAM_SENSOR_BITS_PER_PIXEL   12
3064    #undef  CAM_WHITE_LEVEL
3065    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
3066    #undef  CAM_BLACK_LEVEL
3067    #define CAM_BLACK_LEVEL             127
3068
3069    #undef CAM_USES_ASPECT_CORRECTION
3070    #define CAM_USES_ASPECT_CORRECTION  1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
3071    #undef CAM_USES_ASPECT_YCORRECTION
3072    #define CAM_USES_ASPECT_YCORRECTION  0  //only uses mappings on x coordinate
3073
3074    //games mappings
3075        #undef GAMES_SCREEN_WIDTH
3076        #define GAMES_SCREEN_WIDTH 360
3077        #undef GAMES_SCREEN_HEIGHT
3078        #define GAMES_SCREEN_HEIGHT 240
3079
3080    #undef CAM_BITMAP_PALETTE
3081    #define CAM_BITMAP_PALETTE    7
3082
3083    #undef ASPECT_XCORRECTION
3084        #define ASPECT_XCORRECTION(x)  ( ( ((x)<<3) + (x) )  >>2 )
3085        #undef ASPECT_GAMES_XCORRECTION
3086        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
3087        #undef ASPECT_GAMES_YCORRECTION
3088        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
3089
3090    #undef ASPECT_GRID_XCORRECTION
3091    #define ASPECT_GRID_XCORRECTION(x)  ( ((x)<<3)/9  )  //grids are designed on a 360x240 basis and screen is 320x240, we need x*320/360=x*8/9
3092    #undef ASPECT_GRID_YCORRECTION
3093    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )       //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.
3094
3095    #undef ASPECT_VIEWPORT_XCORRECTION
3096    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
3097    #undef ASPECT_VIEWPORT_YCORRECTION
3098    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
3099    #undef EDGE_HMARGIN
3100    #define EDGE_HMARGIN 28
3101
3102    #define DNG_SUPPORT    1
3103    // pattern
3104    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
3105    // color
3106    //need fixing *****************************************************
3107    #define CAM_COLORMATRIX1                               \
3108      14134, 1000000, -5576, 1000000, -1527, 1000000, \
3109     -1991,  1000000, 10719,  1000000, 1273,   1000000, \
3110      -1158,   1000000, 1929,   1000000, 3581,  1000000
3111    #define cam_CalibrationIlluminant1 17 // Standard Light A
3112
3113    // cropping
3114    #define CAM_JPEG_WIDTH  3600
3115    #define CAM_JPEG_HEIGHT 2700
3116    #define CAM_ACTIVE_AREA_X1 52
3117    #define CAM_ACTIVE_AREA_Y1 14
3118    #define CAM_ACTIVE_AREA_X2 3648
3119    #define CAM_ACTIVE_AREA_Y2 2736
3120
3121   #define CAM_ZEBRA_ASPECT_ADJUST 1
3122
3123   // todo - we may need this to save memory
3124    //#define CAM_ZEBRA_NOBUF 1
3125
3126//----------------------------------------------------------
3127#elif defined (CAMERA_sx30)
3128        #define CAM_PROPSET                                     4
3129        #define CAM_DRYOS                                       1
3130        #define CAM_DRYOS_2_3_R39                       1
3131
3132        #define CAM_RAW_ROWPIX                          4464
3133        #define CAM_RAW_ROWS                            3276
3134
3135        #define CAM_SWIVEL_SCREEN                       1
3136        #define CAM_ADJUSTABLE_ALT_BUTTON       1
3137        #undef  CAM_CAN_SD_OVER_NOT_IN_MF
3138        #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
3139        #define CAM_HAS_VIDEO_BUTTON            1
3140        #define CAM_VIDEO_QUALITY_ONLY          1
3141        #define CAM_BRACKETING                          1
3142        #undef  CAM_VIDEO_CONTROL
3143        #define CAM_MULTIPART                           1
3144        #define CAM_HAS_JOGDIAL                         1
3145        #undef  CAM_USE_ZOOM_FOR_MF
3146        #undef  CAM_UNCACHED_BIT                        // shut up compiler
3147        #define CAM_UNCACHED_BIT                        0x40000000
3148
3149        // pattern
3150        #define cam_CFAPattern 0x01000201 // Green  Blue  Red  Green
3151        // color
3152
3153        // TODO - Still needs work
3154        #define cam_CalibrationIlluminant1      1 // Daylight
3155
3156        #define CAM_COLORMATRIX1                               \
3157          1301431, 1000000,  -469837, 1000000, -102652, 1000000, \
3158          -200195, 1000000,   961551, 1000000,  238645, 1000000, \
3159           -16441, 1000000,   142319, 1000000,  375979, 1000000
3160
3161        // cropping
3162        #define CAM_JPEG_WIDTH                          4368 //4320
3163        #define CAM_JPEG_HEIGHT                         3254 //3240
3164        #define CAM_ACTIVE_AREA_X1                      24
3165        #define CAM_ACTIVE_AREA_Y1                      10
3166        #define CAM_ACTIVE_AREA_X2                      (4464-72)
3167        #define CAM_ACTIVE_AREA_Y2                      (3276-12)
3168        // camera name
3169        #define PARAM_CAMERA_NAME                       4 // parameter number for GetParameterData
3170        #undef  CAM_SENSOR_BITS_PER_PIXEL
3171        #undef  CAM_WHITE_LEVEL
3172        #undef  CAM_BLACK_LEVEL
3173        #define CAM_SENSOR_BITS_PER_PIXEL       12
3174        #define CAM_WHITE_LEVEL                         ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
3175        #define CAM_BLACK_LEVEL                         127
3176
3177        #define CAM_EXT_TV_RANGE                        1
3178        #define CAM_QUALITY_OVERRIDE            1
3179
3180        // copied from the SX200 which has the same video buffer size
3181        #undef CAM_USES_ASPECT_CORRECTION
3182        #undef CAM_USES_ASPECT_YCORRECTION
3183        #define CAM_USES_ASPECT_CORRECTION              1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
3184        #define CAM_USES_ASPECT_YCORRECTION             0  //only uses mappings on x coordinate
3185
3186        #undef ASPECT_XCORRECTION
3187        #define ASPECT_XCORRECTION(x)  ( ( ((x)<<3) + (x) )  >>2 )  //correction x*screen_buffer_width/screen_width = x*720/320 = x*9/4 = (x<<3 + x)>>2
3188
3189        #undef ASPECT_GRID_XCORRECTION
3190        #define ASPECT_GRID_XCORRECTION(x)  ( ((x)<<3)/9  )  //grids are designed on a 360x240 basis and screen is 320x240, we need x*320/360=x*8/9
3191        #undef ASPECT_GRID_YCORRECTION
3192    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )  //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.
3193
3194        #undef ASPECT_VIEWPORT_XCORRECTION
3195        #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
3196        #undef ASPECT_VIEWPORT_YCORRECTION
3197        #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
3198
3199        #undef ASPECT_GAMES_XCORRECTION
3200        // 720/360=2 same aspect than grids and viewport but another approach: there is a lot of corrections to do in game's code, and we decide to paint directly on display buffer wirh another resolution
3201        // used by gui.c that configures the draw environment (trhough new draw_gui function) depending on gui_mode: we have then 360x240 for games (but deformed output:circles are not circles) and 320x240 for
3202        // other modes in perfect aspect ratio 4/3: slightly better visualization: file menus more readable, ...
3203        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
3204        #undef ASPECT_GAMES_YCORRECTION
3205        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
3206
3207        //games mappings
3208        #undef GAMES_SCREEN_WIDTH
3209        #undef GAMES_SCREEN_HEIGHT
3210        #define GAMES_SCREEN_WIDTH              360
3211        #define GAMES_SCREEN_HEIGHT             240
3212
3213    #define CAM_ZEBRA_ASPECT_ADJUST 1
3214    #define CAM_ZEBRA_NOBUF 1
3215
3216        #undef CAM_BITMAP_PALETTE
3217        #define CAM_BITMAP_PALETTE              7
3218
3219   //zebra letterbox for saving memory
3220   #undef ZEBRA_HMARGIN0
3221   #define ZEBRA_HMARGIN0  30 //this 30 rows are not used by the display buffer is 720x240 effective, no 960x270, i.e. (270-240) reduction in widht possible but not done (more difficult to manage it and slower).
3222 
3223   #undef EDGE_HMARGIN
3224   #define EDGE_HMARGIN 2
3225   #define CAM_CHDK_PTP 1
3226       
3227        #define CAM_DATE_FOLDER_NAMING  1
3228
3229        // EXMEM memory allocation values
3230        #define EXMEM_HEAP_SKIP (0x08000000-0x07D08A00)                 // G12 & SX30 uses movie memory buffers at the top of the memory allocated by exmem_alloc
3231        #define EXMEM_BUFFER_SIZE (1024*1024*2)                                 // desired amount of exmem memory to allocate
3232
3233//----------------------------------------------------------
3234#elif defined (CAMERA_g12)
3235    #define CAM_PROPSET                 4
3236    #define CAM_DRYOS                   1
3237    #define CAM_DRYOS_2_3_R39                   1
3238
3239    #define CAM_RAW_ROWPIX              3744
3240    #define CAM_RAW_ROWS                2784
3241
3242        #define CAM_SWIVEL_SCREEN                       1
3243        //#define CAM_ADJUSTABLE_ALT_BUTTON     1
3244
3245    #undef  CAM_EMUL_KEYPRESS_DURATION
3246    #define CAM_EMUL_KEYPRESS_DURATION  10
3247    #undef CAM_MENU_BORDERWIDTH
3248    #define CAM_MENU_BORDERWIDTH        10
3249    #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
3250    #define CAM_MULTIPART               1
3251    #define CAM_HAS_JOGDIAL             1
3252        #undef  CAM_USE_ZOOM_FOR_MF
3253    #define CAM_HAS_ND_FILTER               1
3254    #undef  CAM_CONSOLE_LOG_ENABLED         // Development: internal camera stdout -> A/stdout.txt
3255    #define CAM_BRACKETING              1
3256        #undef  CAM_VIDEO_CONTROL
3257        #define CAM_VIDEO_QUALITY_ONLY          1
3258    #define CAM_EXT_TV_RANGE            1
3259        #define CAM_QUALITY_OVERRIDE 1
3260    #undef OPT_CURVES
3261    #undef CAM_UNCACHED_BIT
3262    #define CAM_UNCACHED_BIT            0x40000000  // S90 @FF8875FC(via ExMem.FreeCacheable)
3263        #define CAM_SHOW_OSD_IN_SHOOT_MENU  1
3264
3265    // camera name
3266    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
3267    #undef  CAM_SENSOR_BITS_PER_PIXEL
3268    #define CAM_SENSOR_BITS_PER_PIXEL   12
3269    #undef  CAM_WHITE_LEVEL
3270    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
3271    #undef  CAM_BLACK_LEVEL
3272    #define CAM_BLACK_LEVEL             127
3273
3274    #undef CAM_BITMAP_PALETTE
3275    #define CAM_BITMAP_PALETTE    7
3276
3277    #undef CAM_USES_ASPECT_CORRECTION
3278    #define CAM_USES_ASPECT_CORRECTION  1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
3279    #undef CAM_USES_ASPECT_YCORRECTION
3280    #define CAM_USES_ASPECT_YCORRECTION  0  //only uses mappings on x coordinate
3281
3282    #undef ASPECT_XCORRECTION
3283        #define ASPECT_XCORRECTION(x)  ( ( ((x)<<3) + (x) )  >>2 )
3284
3285    #undef ASPECT_GRID_XCORRECTION
3286    #define ASPECT_GRID_XCORRECTION(x)  ( ((x)<<3)/9  )  //grids are designed on a 360x240 basis and screen is 320x240, we need x*320/360=x*8/9
3287    #undef ASPECT_GRID_YCORRECTION
3288    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )       //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.
3289
3290    #undef ASPECT_VIEWPORT_XCORRECTION
3291    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
3292    #undef ASPECT_VIEWPORT_YCORRECTION
3293    #define ASPECT_VIEWPORT_YCORRECTION(y) (y)
3294
3295    #undef EDGE_HMARGIN
3296    #define EDGE_HMARGIN 2
3297
3298    // pattern
3299    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
3300    // color
3301    //need fixing *****************************************************
3302    #define CAM_COLORMATRIX1                               \
3303      14134, 1000000, -5576, 1000000, -1527, 1000000, \
3304     -1991,  1000000, 10719,  1000000, 1273,   1000000, \
3305      -1158,   1000000, 1929,   1000000, 3581,  1000000
3306    #define cam_CalibrationIlluminant1 17 // Standard Light A
3307
3308    // cropping
3309    #define CAM_JPEG_WIDTH  3684
3310    #define CAM_JPEG_HEIGHT 2760
3311    #define CAM_ACTIVE_AREA_X1 52
3312    #define CAM_ACTIVE_AREA_Y1 12
3313    #define CAM_ACTIVE_AREA_X2 (CAM_RAW_ROWPIX-8)
3314    #define CAM_ACTIVE_AREA_Y2 (CAM_RAW_ROWS-12)
3315
3316        #undef ASPECT_GAMES_XCORRECTION
3317        #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
3318        #undef ASPECT_GAMES_YCORRECTION
3319        #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
3320
3321    //games mappings
3322        #undef GAMES_SCREEN_WIDTH
3323        #define GAMES_SCREEN_WIDTH 360
3324        #undef GAMES_SCREEN_HEIGHT
3325        #define GAMES_SCREEN_HEIGHT 240
3326
3327        #define CAM_ZEBRA_ASPECT_ADJUST 1
3328
3329   //zebra letterbox for saving memory
3330   #undef ZEBRA_HMARGIN0
3331   #define ZEBRA_HMARGIN0  30 //this 30 rows are not used by the display buffer is 720x240 effective, no 960x270, i.e. (270-240) reduction in widht possible but not done (more difficult to manage it and slower).
3332       
3333        #define CAM_DATE_FOLDER_NAMING  1
3334
3335        #define CAM_CHDK_PTP 1
3336
3337        // EXMEM memory allocation values
3338        #define EXMEM_HEAP_SKIP (0x08000000-0x07D08A00)                 // G12 & SX30 uses movie memory buffers at the top of the memory allocated by exmem_alloc
3339        #define EXMEM_BUFFER_SIZE (1024*1024*2)                                 // desired amount of exmem memory to allocate
3340
3341//----------------------------------------------------------
3342
3343#elif defined (CAMERA_ixus120_sd940)
3344        #define CAM_DRYOS_2_3_R39                       1  //stat is different, as well as some other functions
3345        #define SYNCHABLE_REMOTE_NOT_ENABLED 1
3346    #define CAM_PROPSET                 3
3347    #define CAM_DRYOS                   1
3348
3349    #define CAM_RAW_ROWPIX              4080  //  12M 41044080 ?? // from calcs see 100C lib.c
3350    #define CAM_RAW_ROWS                3048  //  "     "    "    "    "
3351                                                                                       
3352    #undef CAM_SWIVEL_SCREEN
3353    #undef CAM_ADJUSTABLE_ALT_BUTTON
3354    #define CAM_CAN_SD_OVER_NOT_IN_MF   1
3355    #define CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 1
3356    #undef CAM_HAS_VIDEO_BUTTON
3357    #define CAM_VIDEO_QUALITY_ONLY          1
3358        #define CAM_AF_SCAN_DURING_VIDEO_RECORD 1
3359    #define CAM_BRACKETING              1
3360    #undef  CAM_VIDEO_CONTROL
3361    #undef  CAM_HAS_IRIS_DIAPHRAGM
3362    #define CAM_MULTIPART               1
3363    #undef CAM_HAS_JOGDIAL
3364    #undef  CAM_USE_ZOOM_FOR_MF
3365    #undef  CAM_UNCACHED_BIT  // shut up compiler
3366    #define CAM_UNCACHED_BIT    0x40000000
3367    #define CAM_HAS_ND_FILTER           1
3368    #define CAM_CAN_SD_OVERRIDE         1
3369
3370    #define DNG_SUPPORT                 1
3371    // pattern
3372    #define cam_CFAPattern 0x02010100 // Red  Green  Green  Blue
3373    // color
3374
3375    #undef CAM_BITMAP_PALETTE
3376    #define CAM_BITMAP_PALETTE    3 
3377
3378    #define CAM_COLORMATRIX1                               \
3379      827547, 1000000, -290458, 1000000, -126086, 1000000, \
3380     -12829,  1000000, 530507,  1000000, 50537,   1000000, \
3381      5181,   1000000, 48183,   1000000, 245014,  1000000
3382
3383    #define cam_CalibrationIlluminant1 1 // Daylight
3384    // cropping
3385    #define CAM_JPEG_WIDTH  4000
3386    #define CAM_JPEG_HEIGHT 3000
3387    #define CAM_ACTIVE_AREA_X1 20
3388    #define CAM_ACTIVE_AREA_Y1 12
3389    #define CAM_ACTIVE_AREA_X2 4056
3390    #define CAM_ACTIVE_AREA_Y2 3038
3391    // camera name
3392    #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
3393    #undef  CAM_SENSOR_BITS_PER_PIXEL
3394    #undef  CAM_WHITE_LEVEL
3395    #undef  CAM_BLACK_LEVEL
3396    #define CAM_SENSOR_BITS_PER_PIXEL   12
3397    #define CAM_WHITE_LEVEL             ((1<<CAM_SENSOR_BITS_PER_PIXEL)-1)
3398    #define CAM_BLACK_LEVEL             127
3399
3400    #define CAM_EXT_TV_RANGE            1
3401
3402    #define  CAM_SHOW_OSD_IN_SHOOT_MENU  1
3403
3404    //nandoide sept-2009
3405    #undef CAM_USES_ASPECT_CORRECTION
3406    #undef CAM_USES_ASPECT_YCORRECTION
3407    #define CAM_USES_ASPECT_CORRECTION  1  //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
3408    #define CAM_USES_ASPECT_YCORRECTION  0  //only uses mappings on x coordinate
3409
3410
3411    #undef ASPECT_XCORRECTION
3412    #define ASPECT_XCORRECTION(x)  (((x)<<1))   //correction x*screen_buffer_width/screen_width
3413    #undef ASPECT_GRID_XCORRECTION
3414    #define ASPECT_GRID_XCORRECTION(x)  ( (x) )  //grids are designed on a 360x240 basis
3415    #undef ASPECT_GRID_YCORRECTION
3416    #define ASPECT_GRID_YCORRECTION(y)  ( (y) )       //y correction for grids  made on a 360x240 As the buffer is 720x240 we have no correction here.
3417
3418    #undef ASPECT_VIEWPORT_XCORRECTION
3419    #define ASPECT_VIEWPORT_XCORRECTION(x) ASPECT_GRID_XCORRECTION(x) //viewport is 360x240 and screen 320x240, we need x*320/360=x*8/9, equal than grids, used by edgeoverlay
3420    #undef ASPECT_VIEWPORT_YCORRECTION
3421    #define ASPECT_VIEWPORT_YCORRECTION(y) ( (y) )
3422    #undef EDGE_HMARGIN
3423    #define EDGE_HMARGIN 20
3424
3425    //games mappings
3426        // renamed GAMES_SCREEN_WIDTH / GAMES_SCREEN_HEIGHT
3427   #undef GAMES_SCREEN_WIDTH
3428   #undef GAMES_SCREEN_HEIGHT
3429   #define GAMES_SCREEN_WIDTH 360
3430   #define GAMES_SCREEN_HEIGHT 240
3431   #undef ASPECT_GAMES_XCORRECTION
3432   // 720/360=2 same aspect than grids and viewport but another approach: there is a lot of corrections to do in game's code, and we decide to paint directly on display buffer wirh another resolution
3433   // used by gui.c that configures the draw environment (trhough new draw_gui function) depending on gui_mode: we have then 360x240 for games (but deformed output:circles are not circles) and 320x240 for
3434   // other modes in perfect aspect ratio 4/3: slightly better visualization: file menus more readable, ...
3435   #define ASPECT_GAMES_XCORRECTION(x)   ( ((x)<<1) )
3436   #undef ASPECT_GAMES_YCORRECTION
3437   #define ASPECT_GAMES_YCORRECTION(y)   ( (y) )  //none
3438
3439   //zebra letterbox for saving memory
3440
3441   #undef ZEBRA_HMARGIN0
3442   #define ZEBRA_HMARGIN0  30 //this 30 rows are not used by the display buffer is 720x240 effective, no 960x270, i.e. (270-240) reduction in widht possible but not done (more difficult to manage it and slower).
3443
3444   #define CAM_ZEBRA_ASPECT_ADJUST 1
3445   #define CAM_ZEBRA_NOBUF 1
3446   
3447   #define CAM_CHDK_PTP 1
3448
3449   //----------------------------------------------------------
3450
3451#else
3452        #error camera type not defined
3453#endif
3454//==========================================================
3455// END of Camera-dependent settings
3456//==========================================================
3457
3458
3459// curves only work in 10bpp for now
3460#if CAM_SENSOR_BITS_PER_PIXEL != 10
3461#undef OPT_CURVES
3462#endif
3463
3464#ifndef OPT_PTP
3465#undef CAM_CHDK_PTP
3466#endif
3467
3468#endif /* CAMERA_H */
Note: See TracBrowser for help on using the repository browser.