1 /* Copyright (c) 2013, 2016, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef __MM_QCAMERA_MAIN_MENU_H__
31 #define __MM_QCAMERA_MAIN_MENU_H__
32 
33 // Camera dependencies
34 #include "mm_camera_interface.h"
35 #include "mm_jpeg_interface.h"
36 
37 #define VIDEO_BUFFER_SIZE       (PREVIEW_WIDTH * PREVIEW_HEIGHT * 3/2)
38 #define THUMBNAIL_BUFFER_SIZE   (THUMBNAIL_WIDTH * THUMBNAIL_HEIGHT * 3/2)
39 #define SNAPSHOT_BUFFER_SIZE    (PICTURE_WIDTH * PICTURE_HEIGHT * 3/2)
40 
41 /*===========================================================================
42  * Macro
43  *===========================================================================*/
44 #define PREVIEW_FRAMES_NUM    5
45 #define VIDEO_FRAMES_NUM      5
46 #define THUMBNAIL_FRAMES_NUM  1
47 #define SNAPSHOT_FRAMES_NUM   1
48 #define MAX_NUM_FORMAT        32
49 
50 typedef enum
51 {
52   START_PREVIEW,
53   STOP_PREVIEW,
54   SET_WHITE_BALANCE,
55   SET_TINTLESS_ENABLE,
56   TOGGLE_SHDR,
57   SET_EXP_METERING,
58   TOGGLE_IRLED,
59   TOGGLE_EZTUNE,
60   SET_ISO,
61   BRIGHTNESS_GOTO_SUBMENU,
62   CONTRAST_GOTO_SUBMENU,
63   EV_GOTO_SUBMENU,
64   SATURATION_GOTO_SUBMENU,
65   SET_ZOOM,
66   SET_SHARPNESS,
67   TAKE_JPEG_SNAPSHOT,
68   START_RECORDING,
69   STOP_RECORDING,
70   BEST_SHOT,
71   LIVE_SHOT,
72   FLASH_MODES,
73   TOGGLE_ZSL,
74   TAKE_RAW_SNAPSHOT,
75   SWITCH_SNAP_RESOLUTION,
76   TOGGLE_WNR,
77   SPECIAL_EFFECTS,
78   SET_MN_WHITE_BALANCE,
79   ANTI_BANDING,
80   SET_FLIP_MODE,
81   BURST_MODE_SNAPSHOT,
82   CONCURRENT_NDR_NONHDR,
83   EXIT
84 } Camera_main_menu_t;
85 
86 typedef enum
87 {
88   ACTION_NO_ACTION,
89   ACTION_START_PREVIEW,
90   ACTION_STOP_PREVIEW,
91   ACTION_SET_WHITE_BALANCE,
92   ACTION_SET_MN_WHITE_BALANCE,
93   ACTION_SET_TINTLESS_ENABLE,
94   ACTION_TOGGLE_SHDR,
95   ACTION_SET_EXP_METERING,
96   ACTION_TOGGLE_IR_MODE,
97   ACTION_TOGGLE_AFR,
98   ACTION_TOGGLE_EZTUNE,
99   ACTION_SET_ISO,
100   ACTION_BRIGHTNESS_INCREASE,
101   ACTION_BRIGHTNESS_DECREASE,
102   ACTION_CONTRAST_INCREASE,
103   ACTION_CONTRAST_DECREASE,
104   ACTION_EV_INCREASE,
105   ACTION_EV_DECREASE,
106   ACTION_SATURATION_INCREASE,
107   ACTION_SATURATION_DECREASE,
108   ACTION_SET_ZOOM,
109   ACTION_SHARPNESS_INCREASE,
110   ACTION_SHARPNESS_DECREASE,
111   ACTION_TAKE_JPEG_SNAPSHOT,
112   ACTION_START_RECORDING,
113   ACTION_STOP_RECORDING,
114   ACTION_SET_BESTSHOT_MODE,
115   ACTION_TAKE_LIVE_SNAPSHOT,
116   ACTION_SET_FLASH_MODE,
117   ACTION_SWITCH_CAMERA,
118   ACTION_TOGGLE_ZSL,
119   ACTION_TAKE_RAW_SNAPSHOT,
120   ACTION_SWITCH_RESOLUTION,
121   ACTION_TOGGLE_WNR,
122   ACTION_SPECIAL_EFFECTS,
123   ACTION_ANTI_BANDING,
124   ACTION_BURST_MODE_SNAPSHOT,
125   ACTION_FLIP_MODE,
126   ACTION_CONCURRENT_NDR_NONHDR,
127   ACTION_EXIT
128 } camera_action_t;
129 
130 #define INVALID_KEY_PRESS 0
131 #define BASE_OFFSET  ('Z' - 'A' + 1)
132 #define BASE_OFFSET_NUM  ('Z' - 'A' + 2)
133 #define PAD_TO_WORD(a)  (((a)+3)&~3)
134 
135 
136 #define SQCIF_WIDTH     128
137 #define SQCIF_HEIGHT     96
138 #define QCIF_WIDTH      176
139 #define QCIF_HEIGHT     144
140 #define QVGA_WIDTH      320
141 #define QVGA_HEIGHT     240
142 #define HD_THUMBNAIL_WIDTH      256
143 #define HD_THUMBNAIL_HEIGHT     144
144 #define CIF_WIDTH       352
145 #define CIF_HEIGHT      288
146 #define VGA_WIDTH       640
147 #define VGA_HEIGHT      480
148 #define WVGA_WIDTH      800
149 #define WVGA_HEIGHT     480
150 #define WVGA_PLUS_WIDTH      960
151 #define WVGA_PLUS_HEIGHT     720
152 
153 #define MP1_WIDTH      1280
154 #define MP1_HEIGHT      960
155 #define MP2_WIDTH      1600
156 #define MP2_HEIGHT     1200
157 #define MP3_WIDTH      2048
158 #define MP3_HEIGHT     1536
159 #define MP5_WIDTH      2592
160 #define MP5_HEIGHT     1944
161 #define MP8_WIDTH      3264
162 #define MP8_HEIGHT     2448
163 #define MP12_WIDTH     4000
164 #define MP12_HEIGHT    3000
165 
166 #define SVGA_WIDTH      800
167 #define SVGA_HEIGHT     600
168 #define XGA_WIDTH      1024
169 #define XGA_HEIGHT      768
170 #define HD720_WIDTH    1280
171 #define HD720_HEIGHT    720
172 #define HD720_PLUS_WIDTH    1440
173 #define HD720_PLUS_HEIGHT   1080
174 #define WXGA_WIDTH     1280
175 #define WXGA_HEIGHT     768
176 #define HD1080_WIDTH   1920
177 #define HD1080_HEIGHT  1080
178 
179 
180 #define ONEMP_WIDTH    1280
181 #define SXGA_WIDTH     1280
182 #define UXGA_WIDTH     1600
183 #define QXGA_WIDTH     2048
184 #define FIVEMP_WIDTH   2560
185 
186 
187 #define ONEMP_HEIGHT    960
188 #define SXGA_HEIGHT     1024
189 #define UXGA_HEIGHT     1200
190 #define QXGA_HEIGHT     1536
191 #define FIVEMP_HEIGHT   1920
192 
193 
194 typedef enum
195 {
196   RESOLUTION_MIN,
197   QCIF                  = RESOLUTION_MIN,
198   QVGA,
199   VGA,
200   WVGA,
201   WVGA_PLUS ,
202   HD720,
203   HD720_PLUS,
204   HD1080,
205   RESOLUTION_PREVIEW_VIDEO_MAX = HD1080,
206   WXGA,
207   MP1,
208   MP2,
209   MP3,
210   MP5,
211   MP8,
212   MP12,
213   RESOLUTION_MAX         = MP12,
214 } Camera_Resolution;
215 
216 typedef struct{
217     uint16_t width;
218     uint16_t  height;
219     char * name;
220     char * str_name;
221     int supported;
222 } DIMENSION_TBL_T;
223 
224 typedef enum {
225     WHITE_BALANCE_STATE,
226     WHITE_BALANCE_TEMPERATURE,
227     BRIGHTNESS_CTRL,
228     EV,
229     CONTRAST_CTRL,
230     SATURATION_CTRL,
231     SHARPNESS_CTRL
232 } Get_Ctrl_modes;
233 
234 typedef enum {
235     AUTO_EXP_FRAME_AVG,
236     AUTO_EXP_CENTER_WEIGHTED,
237     AUTO_EXP_SPOT_METERING,
238     AUTO_EXP_SMART_METERING,
239     AUTO_EXP_USER_METERING,
240     AUTO_EXP_SPOT_METERING_ADV,
241     AUTO_EXP_CENTER_WEIGHTED_ADV,
242     AUTO_EXP_MAX
243 } Exp_Metering_modes;
244 
245 typedef enum {
246   ISO_AUTO,
247   ISO_DEBLUR,
248   ISO_100,
249   ISO_200,
250   ISO_400,
251   ISO_800,
252   ISO_1600,
253   ISO_MAX
254 } ISO_modes;
255 
256 typedef enum {
257   BESTSHOT_AUTO,
258   BESTSHOT_ACTION,
259   BESTSHOT_PORTRAIT,
260   BESTSHOT_LANDSCAPE,
261   BESTSHOT_NIGHT,
262   BESTSHOT_NIGHT_PORTRAIT,
263   BESTSHOT_THEATRE,
264   BESTSHOT_BEACH,
265   BESTSHOT_SNOW,
266   BESTSHOT_SUNSET,
267   BESTSHOT_ANTISHAKE,
268   BESTSHOT_FIREWORKS,
269   BESTSHOT_SPORTS,
270   BESTSHOT_PARTY,
271   BESTSHOT_CANDLELIGHT,
272   BESTSHOT_ASD,
273   BESTSHOT_BACKLIGHT,
274   BESTSHOT_FLOWERS,
275   BESTSHOT_AR,
276   BESTSHOT_HDR,
277   BESTSHOT_MAX
278 }Bestshot_modes;
279 
280 typedef enum {
281   SPL_EFFECT_OFF,
282   SPL_EFFECT_MONO,
283   SPL_EFFECT_NEGATIVE,
284   SPL_EFFECT_SOLARIZE,
285   SPL_EFFECT_SEPIA,
286   SPL_EFFECT_POSTERIZE,
287   SPL_EFFECT_WHITEBOARD,
288   SPL_EFFECT_BLACKBOARD,
289   SPL_EFFECT_AQUA,
290   SPL_EFFECT_EMBOSS,
291   SPL_EFFECT_SKETCH,
292   SPL_EFFECT_NEON,
293   SPL_EFFECT_BEAUTY,
294   SPL_EFFECT_MAX
295 } spl_effect_modes;
296 
297 typedef enum {
298   ANTIBANDING_OFF,
299   ANTIBANDING_60HZ,
300   ANTIBANDING_50HZ,
301   ANTIBANDING_AUTO,
302   ANTIBANDING_MAX,
303 }antibanding_types;
304 
305 typedef enum {
306   MODE_NO_FLIP,
307   MODE_FLIP_H,
308   MODE_FLIP_V,
309   MODE_FLIP_V_H,
310   MODE_FLIP_MAX,
311 }flipmodes_types;
312 
313 typedef enum {
314     FLASH_MODE_OFF,
315     FLASH_MODE_AUTO,
316     FLASH_MODE_ON,
317     FLASH_MODE_TORCH,
318     FLASH_MODE_MAX,
319 }Flash_modes;
320 
321 typedef enum {
322   WB_OFF,
323   WB_AUTO,
324   WB_INCANDESCENT,
325   WB_FLUORESCENT,
326   WB_WARM_FLUORESCENT,
327   WB_DAYLIGHT,
328   WB_CLOUDY_DAYLIGHT,
329   WB_TWILIGHT,
330   WB_SHADE,
331   WB_MANUAL,
332   WB_MAX
333 } White_Balance_modes;
334 
335 typedef enum {
336   MANUAL_WB_CCT,
337   MANUAL_WB_GAIN,
338   MANUAL_WB_MAX
339 }Manual_wb_modes;
340 
341 typedef enum
342 {
343   MENU_ID_MAIN,
344   MENU_ID_WHITEBALANCECHANGE,
345   MENU_ID_EXPMETERINGCHANGE,
346   MENU_ID_GET_CTRL_VALUE,
347   MENU_ID_TOGGLEAFR,
348   MENU_ID_ISOCHANGE,
349   MENU_ID_BRIGHTNESSCHANGE,
350   MENU_ID_CONTRASTCHANGE,
351   MENU_ID_EVCHANGE,
352   MENU_ID_SATURATIONCHANGE,
353   MENU_ID_ZOOMCHANGE,
354   MENU_ID_SHARPNESSCHANGE,
355   MENU_ID_BESTSHOT,
356   MENU_ID_FLASHMODE,
357   MENU_ID_SENSORS,
358   MENU_ID_SWITCH_RES,
359   MENU_ID_SPECIAL_EFFECTS,
360   MENU_ID_WHITEBALANCE_MANUAL,
361   MENU_ID_ANTI_BANDING,
362   MENU_ID_FLIP_MODE,
363   MENU_ID_INVALID,
364 } menu_id_change_t;
365 
366 typedef enum
367 {
368   DECREASE_ZOOM,
369   INCREASE_ZOOM,
370   INCREASE_STEP_ZOOM,
371   DECREASE_STEP_ZOOM,
372 } Camera_Zoom;
373 
374 typedef enum
375 {
376   INC_CONTRAST,
377   DEC_CONTRAST,
378 } Camera_Contrast_changes;
379 
380 typedef enum
381 {
382   INC_BRIGHTNESS,
383   DEC_BRIGHTNESS,
384 } Camera_Brightness_changes;
385 
386 typedef enum
387 {
388   INCREASE_EV,
389   DECREASE_EV,
390 } Camera_EV_changes;
391 
392 typedef enum {
393   INC_SATURATION,
394   DEC_SATURATION,
395 } Camera_Saturation_changes;
396 
397 typedef enum
398 {
399   INC_ISO,
400   DEC_ISO,
401 } Camera_ISO_changes;
402 
403 typedef enum
404 {
405   INC_SHARPNESS,
406   DEC_SHARPNESS,
407 } Camera_Sharpness_changes;
408 
409 typedef enum {
410   ZOOM_IN,
411   ZOOM_OUT,
412 } Zoom_direction;
413 
414 typedef struct{
415     Camera_main_menu_t main_menu;
416     char * menu_name;
417 } CAMERA_MAIN_MENU_TBL_T;
418 
419 typedef struct{
420     char * menu_name;
421     int present;
422 } CAMERA_SENSOR_MENU_TLB_T;
423 
424 typedef struct{
425     Camera_Resolution cs_id;
426     uint16_t width;
427     uint16_t  height;
428     char * name;
429     char * str_name;
430 } PREVIEW_DIMENSION_TBL_T;
431 
432 typedef struct {
433   White_Balance_modes wb_id;
434   char * wb_name;
435 } WHITE_BALANCE_TBL_T;
436 
437 typedef struct {
438   Manual_wb_modes wb_id;
439   char * wb_name;
440 } MN_WHITE_BALANCE_TBL_T;
441 
442 typedef struct {
443   Get_Ctrl_modes get_ctrl_id;
444   char * get_ctrl_name;
445 } GET_CTRL_TBL_T;
446 
447 typedef struct{
448   Exp_Metering_modes exp_metering_id;
449   char * exp_metering_name;
450 } EXP_METERING_TBL_T;
451 
452 typedef struct {
453   Bestshot_modes bs_id;
454   char *name;
455 } BESTSHOT_MODE_TBT_T;
456 
457 typedef struct {
458   spl_effect_modes sp_id;
459   char *name;
460 } SPECIAL_EFFECT_MODE_TBT_T;
461 
462 typedef struct {
463   antibanding_types sp_id;
464   char *name;
465 } ANTI_BANDING_TBT_T;
466 
467 typedef struct {
468   flipmodes_types sp_id;
469   char *name;
470 }FLIP_MODES_TBT_T;
471 
472 typedef struct {
473   Flash_modes bs_id;
474   char *name;
475 } FLASH_MODE_TBL_T;
476 
477 typedef struct {
478   ISO_modes iso_modes;
479   char *iso_modes_name;
480 } ISO_TBL_T;
481 
482 typedef struct {
483   Zoom_direction zoom_direction;
484   char * zoom_direction_name;
485 } ZOOM_TBL_T;
486 
487 typedef struct {
488   Camera_Sharpness_changes sharpness_change;
489   char *sharpness_change_name;
490 } SHARPNESS_TBL_T;
491 
492 typedef struct {
493   Camera_Brightness_changes bc_id;
494   char * brightness_name;
495 } CAMERA_BRIGHTNESS_TBL_T;
496 
497 typedef struct {
498   Camera_Contrast_changes cc_id;
499   char * contrast_name;
500 } CAMERA_CONTRST_TBL_T;
501 
502 typedef struct {
503   Camera_EV_changes ec_id;
504   char * EV_name;
505 } CAMERA_EV_TBL_T;
506 
507 typedef struct {
508   Camera_Saturation_changes sc_id;
509   char * saturation_name;
510 } CAMERA_SATURATION_TBL_T;
511 
512 typedef struct {
513   Camera_Sharpness_changes bc_id;
514   char * sharpness_name;
515 } CAMERA_SHARPNESS_TBL_T;
516 
517 #endif /* __MM_QCAMERA_MAIN_MENU_H__ */
518