source: trunk/include/camera.h @ 1091

Revision 1091, 133.7 KB checked in by reyalP, 2 years ago (diff)

from chdkde r599 disable extra long exposure on a720, see http://chdk.setepontos.com/index.php?topic=6182.0

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