source: trunk/include/camera.h @ 1124

Revision 1124, 135.0 KB checked in by reyalP, 2 years ago (diff)

exmem improvements, experimental support for loading CHDK binary in exmem - from philmoz in http://chdk.setepontos.com/index.php?topic=650.msg63808#msg63808

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