-
Notifications
You must be signed in to change notification settings - Fork 11
/
camera.h
executable file
·1411 lines (1241 loc) · 37.6 KB
/
camera.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef __CAMERA_H__
#define __CAMERA_H__
#include <stdint.h>
#include "msm_camera.h"
#include <pthread.h>
#define MSM_CAMERA_CONTROL "/dev/msm_camera/control%d"
#define MSM_CAMERA_CONFIG "/dev/msm_camera/config%d"
#define MSM_CAMERA_FRAME "/dev/msm_camera/frame%d"
#define TRUE (1)
#define FALSE (0)
#define JPEG_EVENT_DONE 0
#define EXIFTAGID_GPS_LATITUDE_REF 0x10001
#define EXIFTAGID_GPS_LATITUDE 0x20002
#define EXIFTAGID_GPS_LONGITUDE_REF 0x30003
#define EXIFTAGID_GPS_LONGITUDE 0x40004
#define EXIFTAGID_GPS_ALTITUDE_REF 0x50005
#define EXIFTAGID_GPS_ALTITUDE 0x60006
#define EXIFTAGID_GPS_TIMESTAMP 0x70007
#define EXIFTAGID_GPS_PROCESSINGMETHOD 0x1b001b
#define EXIFTAGID_GPS_DATESTAMP 0x1d001d
#define EXIFTAGID_EXIF_DATE_TIME_ORIGINAL 0x3a9003
#define EXIFTAGID_FOCAL_LENGTH 0x45920a
typedef enum {
MM_CAMERA_SUCCESS,
MM_CAMERA_ERR_GENERAL,
MM_CAMERA_ERR_NO_MEMORY,
MM_CAMERA_ERR_NOT_SUPPORTED,
MM_CAMERA_ERR_INVALID_INPUT,
MM_CAMERA_ERR_INVALID_OPERATION,
MM_CAMERA_ERR_ENCODE,
MM_CAMERA_ERR_BUFFER_REG,
MM_CAMERA_ERR_PMEM_ALLOC,
MM_CAMERA_ERR_CAPTURE_FAILED,
MM_CAMERA_ERR_CAPTURE_TIMEOUT,
}mm_camera_status_t;
typedef uint32_t jpeg_event_t;
typedef uint32_t exif_tag_id_t;
typedef enum {
EXIF_BYTE = 1,
EXIF_ASCII = 2,
EXIF_SHORT = 3,
EXIF_LONG = 4,
EXIF_RATIONAL = 5,
EXIF_UNDEFINED = 7,
EXIF_SLONG = 9,
EXIF_SRATIONAL = 10
} exif_tag_type_t;
typedef struct {
uint32_t num;
uint32_t denom;
} rat_t;
typedef struct {
int32_t num;
int32_t denom;
} srat_t;
typedef struct {
exif_tag_type_t type;
uint8_t copy;
uint32_t count;
union {
char *_ascii;
uint8_t *_bytes;
uint8_t _byte;
uint16_t *_shorts;
uint16_t _short;
uint32_t *_longs;
uint32_t _long;
rat_t *_rats;
rat_t _rat;
uint8_t *_undefined;
int32_t *_slongs;
int32_t _slong;
srat_t *_srats;
srat_t _srat;
} data;
} exif_tag_entry_t;
typedef struct {
uint32_t tag_id;
exif_tag_entry_t tag_entry;
} exif_tags_info_t;
typedef struct {
uint8_t* ptr;
uint32_t actual_size;
uint32_t size;
int32_t fd;
uint32_t offset;
}mm_camera_buffer_t;
typedef struct {
uint32_t in1_w;
uint32_t out1_w;
uint32_t in1_h;
uint32_t out1_h;
uint32_t in2_w;
uint32_t out2_w;
uint32_t in2_h;
uint32_t out2_h;
uint8_t update_flag;
} common_crop_t;
typedef enum {
/* 1st 32 params*/
CAMERA_PARM_PICT_SIZE,
CAMERA_PARM_ZOOM_RATIO,
CAMERA_PARM_HISTOGRAM,
CAMERA_PARM_DIMENSION,
CAMERA_PARM_FPS,
CAMERA_PARM_FPS_MODE, /*5*/
CAMERA_PARM_EFFECT,
CAMERA_PARM_EXPOSURE_COMPENSATION,
CAMERA_PARM_EXPOSURE,
CAMERA_PARM_SHARPNESS,
CAMERA_PARM_CONTRAST, /*10*/
CAMERA_PARM_SATURATION,
CAMERA_PARM_BRIGHTNESS,
CAMERA_PARM_WHITE_BALANCE,
CAMERA_PARM_LED_MODE,
CAMERA_PARM_ANTIBANDING, /*15*/
CAMERA_PARM_ROLLOFF,
CAMERA_PARM_CONTINUOUS_AF,
CAMERA_PARM_FOCUS_RECT,
CAMERA_PARM_AEC_ROI,
CAMERA_PARM_AF_ROI, /*20*/
CAMERA_PARM_HJR,
CAMERA_PARM_ISO,
CAMERA_PARM_BL_DETECTION,
CAMERA_PARM_SNOW_DETECTION,
CAMERA_PARM_BESTSHOT_MODE, /*25*/
CAMERA_PARM_ZOOM,
CAMERA_PARM_VIDEO_DIS,
CAMERA_PARM_VIDEO_ROT,
CAMERA_PARM_SCE_FACTOR,
CAMERA_PARM_FD, /*30*/
CAMERA_PARM_MODE,
/* 2nd 32 bits */
CAMERA_PARM_3D_FRAME_FORMAT,
CAMERA_PARM_CAMERA_ID,
CAMERA_PARM_CAMERA_INFO,
CAMERA_PARM_PREVIEW_SIZE, /*35*/
CAMERA_PARM_FOCUS_DISTANCES,
}mm_camera_parm_type_t;
typedef enum {
CAMERA_OPS_STREAMING_PREVIEW,
CAMERA_OPS_STREAMING_ZSL,
CAMERA_OPS_STREAMING_VIDEO,
CAMERA_OPS_CAPTURE, /*not supported*/
CAMERA_OPS_FOCUS,
CAMERA_OPS_GET_PICTURE, /*5*/
CAMERA_OPS_PREPARE_SNAPSHOT,
CAMERA_OPS_SNAPSHOT,
CAMERA_OPS_LIVESHOT,
CAMERA_OPS_RAW_SNAPSHOT,
CAMERA_OPS_VIDEO_RECORDING, /*10*/
CAMERA_OPS_REGISTER_BUFFER,
CAMERA_OPS_UNREGISTER_BUFFER,
}mm_camera_ops_type_t;
typedef struct {
mm_camera_status_t (*mm_camera_start) (mm_camera_ops_type_t ops_type,
void* parm1, void* parm2);
mm_camera_status_t(*mm_camera_stop) (mm_camera_ops_type_t ops_type,
void* parm1, void* parm2);
int8_t (*mm_camera_is_supported) (mm_camera_ops_type_t ops_type);
} mm_camera_ops;
typedef enum {
FRAME_READY,
SNAPSHOT_DONE,
SNAPSHOT_FAILED,
JPEG_ENC_DONE,
JPEG_ENC_FAILED,
} mm_camera_event_type;
typedef struct {
mm_camera_event_type event_type;
union {
mm_camera_buffer_t* encoded_frame;
struct msm_frame* preview_frame;
}event_data;
} mm_camera_event;
typedef struct {
mm_camera_status_t (*mm_camera_query_parms) (mm_camera_parm_type_t parm_type,
void** pp_values, uint32_t* p_count);
mm_camera_status_t (*mm_camera_set_parm) (mm_camera_parm_type_t parm_type,
void* p_value);
mm_camera_status_t(*mm_camera_get_parm) (mm_camera_parm_type_t parm_type,
void* p_value);
int8_t (*mm_camera_is_supported) (mm_camera_parm_type_t parm_type);
int8_t (*mm_camera_is_parm_supported) (mm_camera_parm_type_t parm_type,
void* sub_parm);
}mm_camera_config;
#define NATIVE_CAMERA_INTERFACE 1
#define V4L2_CAMERA_INTERFACE 2
#define PAD_TO_WORD(a) (((a)+3)&~3)
#define PAD_TO_4K(a) (((a)+4095)&~4095)
#define CEILING32(X) (((X) + 0x0001F) & 0xFFFFFFE0)
#define CEILING16(X) (((X) + 0x000F) & 0xFFF0)
#define CEILING4(X) (((X) + 0x0003) & 0xFFFC)
#define CEILING2(X) (((X) + 0x0001) & 0xFFFE)
#define V4L2_PID_MOTION_ISO V4L2_CID_PRIVATE_BASE
#define V4L2_PID_EFFECT (V4L2_CID_PRIVATE_BASE+1)
#define V4L2_PID_HJR (V4L2_CID_PRIVATE_BASE+2)
#define V4L2_PID_LED_MODE (V4L2_CID_PRIVATE_BASE+3)
#define V4L2_PID_PREP_SNAPSHOT (V4L2_CID_PRIVATE_BASE+4)
#define ANDROID_FB0 "/dev/graphics/fb0"
#define LE_FB0 "/dev/fb0"
#define MAX_ROI 2
#define MAX_NUM_PARM 5
#define MAX_NUM_OPS 2
#define MAX_DEV_NAME_LEN 50
#define MAX_SNAPSHOT_BUFFERS 3
typedef enum {
CAM_CTRL_FAILED,
CAM_CTRL_SUCCESS,
CAM_CTRL_INVALID_PARM,
CAM_CTRL_MAX,
} cam_ctrl_status_t;
typedef enum {
CAMERA_PREVIEW_MODE_SNAPSHOT,
CAMERA_PREVIEW_MODE_MOVIE,
CAMERA_PREVIEW_MODE_MOVIE_120FPS,
CAMERA_MAX_PREVIEW_MODE
} cam_preview_mode_t;
typedef enum {
CAMERA_YUV_420_NV12,
CAMERA_YUV_420_NV21,
CAMERA_YUV_420_NV21_ADRENO
} cam_format_t;
typedef enum {
CAMERA_PAD_TO_4K,
CAMERA_PAD_TO_8K
} cam_pad_format_t;
typedef struct {
uint16_t dispWidth;
uint16_t dispHeight;
} cam_ctrl_disp_t;
typedef enum {
CAMERA_MODE_2D = (1<<0),
CAMERA_MODE_3D = (1<<1),
CAMERA_MODE_MAX = CAMERA_MODE_3D,
}camera_mode_t;
typedef enum {
SIDE_BY_SIDE_HALF,
SIDE_BY_SIDE_FULL,
TOP_DOWN_HALF,
TOP_DOWN_FULL,
}cam_3d_frame_format_t;
typedef enum {
CAM_VIDEO_FRAME,
CAM_SNAPSHOT_FRAME,
CAM_PREVIEW_FRAME,
}cam_frame_type_t;
typedef enum {
BACK_CAMERA,
FRONT_CAMERA,
}cam_position_t;
typedef struct {
cam_frame_type_t frame_type;
cam_3d_frame_format_t format;
}camera_3d_frame_t;
typedef struct {
camera_mode_t modes_supported;
int8_t camera_id;
cam_position_t position;
uint32_t sensor_mount_angle;
}camera_info_t;
typedef struct {
camera_mode_t mode;
int8_t camera_id;
}config_params_t;
typedef struct {
uint32_t parm[MAX_NUM_PARM];
uint32_t ops[MAX_NUM_OPS];
uint8_t yuv_output;
uint8_t jpeg_capture;
uint32_t max_pict_width;
uint32_t max_pict_height;
uint32_t max_preview_width;
uint32_t max_preview_height;
uint32_t effect;
camera_mode_t modes;
}cam_prop_t;
typedef struct {
uint16_t video_width; /* Video width seen by VFE could be different than orig. Ex. DIS */
uint16_t video_height; /* Video height seen by VFE */
uint16_t picture_width; /* Picture width seen by VFE */
uint16_t picture_height; /* Picture height seen by VFE */
uint16_t display_width; /* width of display */
uint16_t display_height; /* height of display */
uint16_t orig_video_width; /* original video width received */
uint16_t orig_video_height; /* original video height received */
uint16_t orig_picture_dx; /* original picture width received */
uint16_t orig_picture_dy; /* original picture height received */
uint16_t ui_thumbnail_height;
uint16_t ui_thumbnail_width;
uint16_t thumbnail_height;
uint16_t thumbnail_width;
uint16_t raw_picture_height;
uint16_t raw_picture_width;
uint32_t hjr_xtra_buff_for_bayer_filtering;
cam_format_t prev_format;
cam_format_t enc_format;
cam_format_t thumb_format;
cam_format_t main_img_format;
cam_pad_format_t padding_format;
uint16_t display_luma_width;
uint16_t display_luma_height;
uint16_t display_chroma_width;
uint16_t display_chroma_height;
uint16_t video_luma_width;
uint16_t video_luma_height;
uint16_t video_chroma_width;
uint16_t video_chroma_height;
uint16_t thumbnail_luma_width;
uint16_t thumbnail_luma_height;
uint16_t thumbnail_chroma_width;
uint16_t thumbnail_chroma_height;
uint16_t main_img_luma_width;
uint16_t main_img_luma_height;
uint16_t main_img_chroma_width;
uint16_t main_img_chroma_height;
} cam_ctrl_dimension_t;
typedef enum {
CAMERA_SET_PARM_DISPLAY_INFO,
CAMERA_SET_PARM_DIMENSION,
CAMERA_SET_PARM_ZOOM,
CAMERA_SET_PARM_SENSOR_POSITION,
CAMERA_SET_PARM_FOCUS_RECT,
CAMERA_SET_PARM_LUMA_ADAPTATION,
CAMERA_SET_PARM_CONTRAST,
CAMERA_SET_PARM_BRIGHTNESS,
CAMERA_SET_PARM_EXPOSURE_COMPENSATION,
CAMERA_SET_PARM_SHARPNESS,
CAMERA_SET_PARM_HUE, /* 10 */
CAMERA_SET_PARM_SATURATION,
CAMERA_SET_PARM_EXPOSURE,
CAMERA_SET_PARM_AUTO_FOCUS,
CAMERA_SET_PARM_WB,
CAMERA_SET_PARM_EFFECT,
CAMERA_SET_PARM_FPS,
CAMERA_SET_PARM_FLASH,
CAMERA_SET_PARM_NIGHTSHOT_MODE,
CAMERA_SET_PARM_REFLECT,
CAMERA_SET_PARM_PREVIEW_MODE, /* 20 */
CAMERA_SET_PARM_ANTIBANDING,
CAMERA_SET_PARM_RED_EYE_REDUCTION,
CAMERA_SET_PARM_FOCUS_STEP,
CAMERA_SET_PARM_EXPOSURE_METERING,
CAMERA_SET_PARM_AUTO_EXPOSURE_MODE,
CAMERA_SET_PARM_ISO,
CAMERA_SET_PARM_BESTSHOT_MODE,
CAMERA_SET_PARM_ENCODE_ROTATION,
CAMERA_SET_PARM_PREVIEW_FPS,
CAMERA_SET_PARM_AF_MODE, /* 30 */
CAMERA_SET_PARM_HISTOGRAM,
CAMERA_SET_PARM_FLASH_STATE,
CAMERA_SET_PARM_FRAME_TIMESTAMP,
CAMERA_SET_PARM_STROBE_FLASH,
CAMERA_SET_PARM_FPS_LIST,
CAMERA_SET_PARM_HJR,
CAMERA_SET_PARM_ROLLOFF,
CAMERA_STOP_PREVIEW,
CAMERA_START_PREVIEW,
CAMERA_START_SNAPSHOT, /* 40 */
CAMERA_START_RAW_SNAPSHOT,
CAMERA_STOP_SNAPSHOT,
CAMERA_EXIT,
CAMERA_ENABLE_BSM,
CAMERA_DISABLE_BSM,
CAMERA_GET_PARM_ZOOM,
CAMERA_GET_PARM_MAXZOOM,
CAMERA_GET_PARM_ZOOMRATIOS,
CAMERA_GET_PARM_AF_SHARPNESS,
CAMERA_SET_PARM_LED_MODE, /* 50 */
CAMERA_SET_MOTION_ISO,
CAMERA_AUTO_FOCUS_CANCEL,
CAMERA_GET_PARM_FOCUS_STEP,
CAMERA_ENABLE_AFD,
CAMERA_PREPARE_SNAPSHOT,
CAMERA_SET_FPS_MODE,
CAMERA_START_VIDEO,
CAMERA_STOP_VIDEO,
CAMERA_START_RECORDING,
CAMERA_STOP_RECORDING, /* 60 */
CAMERA_SET_VIDEO_DIS_PARAMS,
CAMERA_SET_VIDEO_ROT_PARAMS,
CAMERA_SET_PARM_AEC_ROI,
CAMERA_SET_CAF,
CAMERA_SET_PARM_BL_DETECTION_ENABLE,
CAMERA_SET_PARM_SNOW_DETECTION_ENABLE,
CAMERA_SET_PARM_STROBE_FLASH_MODE,
CAMERA_SET_PARM_AF_ROI,
CAMERA_START_LIVESHOT,
CAMERA_SET_SCE_FACTOR, /* 70 */
CAMERA_GET_CAPABILITIES,
CAMERA_GET_PARM_DIMENSION,
CAMERA_GET_PARM_LED_MODE,
CAMERA_SET_PARM_FD,
CAMERA_GET_PARM_3D_FRAME_FORMAT,
CAMERA_GET_PARM_FOCUS_DISTANCES,
CAMERA_CTRL_PARM_MAX
} cam_ctrl_type;
typedef struct {
int pic_width;
int pic_hight;
int prev_width;
int prev_hight;
int rotation;
} cam_ctrl_set_dimension_data_t;
#define CAMERA_FPS_DENOMINATOR 1000
/*============================================================================
* DATA DECLARATIONS
============================================================================*/
/* to select no vignette correction, luma vignette correction */
/* or bayer vignette correction */
typedef enum {
CAMERA_NO_VIGNETTE_CORRECTION,
CAMERA_LUMA_VIGNETTE_CORRECTION,
CAMERA_BAYER_VIGNETTE_CORRECTION
} camera_vc_mode_type;
typedef enum {
CAMERA_BVCM_DISABLE,
CAMERA_BVCM_RAW_CAPTURE,
CAMERA_BVCM_OFFLINE_CAPTURE
} camera_bvcm_capture_type;
#ifndef HAVE_CAMERA_SIZE_TYPE
#define HAVE_CAMERA_SIZE_TYPE
struct camera_size_type {
int width;
int height;
};
#endif
/* Sensor position type, used for CAMERA_PARM_SENSOR_POSITION */
typedef enum {
CAMERA_SP_NORMAL = 0,
CAMERA_SP_REVERSE,
} camera_sp_type;
/* Exposure type, used for CAMERA_PARM_EXPOSURE */
typedef enum {
CAMERA_EXPOSURE_MIN_MINUS_1,
CAMERA_EXPOSURE_AUTO = 1, /* This list must match aeecamera.h */
CAMERA_EXPOSURE_DAY,
CAMERA_EXPOSURE_NIGHT,
CAMERA_EXPOSURE_LANDSCAPE,
CAMERA_EXPOSURE_STRONG_LIGHT,
CAMERA_EXPOSURE_SPOTLIGHT,
CAMERA_EXPOSURE_PORTRAIT,
CAMERA_EXPOSURE_MOVING,
CAMERA_EXPOSURE_MAX_PLUS_1
} camera_exposure_type;
typedef enum {
CAMERA_NIGHTSHOT_MODE_OFF,
CAMERA_NIGHTSHOT_MODE_ON,
CAMERA_MAX_NIGHTSHOT_MODE
} camera_nightshot_mode_type;
typedef enum {
CAMERA_EXIT_CB_ABORT = -2, /* AF is aborted */
CAMERA_EXIT_CB_FAILED = -1, /* AF is failed or rejected */
CAMERA_EXIT_CB_DONE = 0, /* AF is sucessful */
CAMERA_CB_MAX,
} camera_af_done_type;
typedef enum {
CAMERA_ERROR_NO_MEMORY,
CAMERA_ERROR_EFS_FAIL, /* Low-level operation failed */
CAMERA_ERROR_EFS_FILE_OPEN, /* File already opened */
CAMERA_ERROR_EFS_FILE_NOT_OPEN, /* File not opened */
CAMERA_ERROR_EFS_FILE_ALREADY_EXISTS, /* File already exists */
CAMERA_ERROR_EFS_NONEXISTENT_DIR, /* User directory doesn't exist */
CAMERA_ERROR_EFS_NONEXISTENT_FILE, /* User directory doesn't exist */
CAMERA_ERROR_EFS_BAD_FILE_NAME, /* Client specified invalid file/directory name*/
CAMERA_ERROR_EFS_BAD_FILE_HANDLE, /* Client specified invalid file/directory name*/
CAMERA_ERROR_EFS_SPACE_EXHAUSTED, /* Out of file system space */
CAMERA_ERROR_EFS_OPEN_TABLE_FULL, /* Out of open-file table slots */
CAMERA_ERROR_EFS_OTHER_ERROR, /* Other error */
CAMERA_ERROR_CONFIG,
CAMERA_ERROR_EXIF_ENCODE,
CAMERA_ERROR_VIDEO_ENGINE,
CAMERA_ERROR_IPL,
CAMERA_ERROR_INVALID_FORMAT,
CAMERA_ERROR_TIMEOUT,
CAMERA_ERROR_ESD,
// CAMERA_ERROR_UNKNOWN,
CAMERA_ERROR_MAX
} camera_error_type;
typedef enum {
CAMERA_SUCCESS = 0,
CAMERA_INVALID_STATE,
CAMERA_INVALID_PARM,
CAMERA_INVALID_FORMAT,
CAMERA_NO_SENSOR,
CAMERA_NO_MEMORY,
CAMERA_NOT_SUPPORTED,
CAMERA_FAILED,
CAMERA_INVALID_STAND_ALONE_FORMAT,
CAMERA_MALLOC_FAILED_STAND_ALONE,
CAMERA_RET_CODE_MAX
} camera_ret_code_type;
typedef enum {
CAMERA_RAW,
CAMERA_JPEG,
CAMERA_PNG,
CAMERA_YCBCR_ENCODE,
CAMERA_ENCODE_TYPE_MAX
} camera_encode_type;
#if !defined FEATURE_CAMERA_ENCODE_PROPERTIES && defined FEATURE_CAMERA_V7
typedef enum {
CAMERA_SNAPSHOT,
CAMERA_RAW_SNAPSHOT
} camera_snapshot_type;
#endif /* nFEATURE_CAMERA_ENCODE_PROPERTIES && FEATURE_CAMERA_V7 */
typedef enum {
/* YCbCr, each pixel is two bytes. Two pixels form a unit.
* MSB is Y, LSB is CB for the first pixel and CR for the second pixel. */
CAMERA_YCBCR,
#ifdef FEATURE_CAMERA_V7
CAMERA_YCBCR_4_2_0,
CAMERA_YCBCR_4_2_2,
CAMERA_H1V1,
CAMERA_H2V1,
CAMERA_H1V2,
CAMERA_H2V2,
CAMERA_BAYER_8BIT,
CAMERA_BAYER_10BIT,
#endif /* FEATURE_CAMERA_V7 */
/* RGB565, each pixel is two bytes.
* MS 5-bit is red, the next 6-bit is green. LS 5-bit is blue. */
CAMERA_RGB565,
/* RGB666, each pixel is four bytes.
* MS 14 bits are zeros, the next 6-bit is red, then 6-bit of green.
* LS 5-bit is blue. */
CAMERA_RGB666,
/* RGB444, each pixel is 2 bytes. The MS 4 bits are zeros, the next
* 4 bits are red, the next 4 bits are green. The LS 4 bits are blue. */
CAMERA_RGB444,
/* Bayer, each pixel is 1 bytes. 2x2 pixels form a unit.
* First line: first byte is blue, second byte is green.
* Second line: first byte is green, second byte is red. */
CAMERA_BAYER_BGGR,
/* Bayer, each pixel is 1 bytes. 2x2 pixels form a unit.
* First line: first byte is green, second byte is blue.
* Second line: first byte is red, second byte is green. */
CAMERA_BAYER_GBRG,
/* Bayer, each pixel is 1 bytes. 2x2 pixels form a unit.
* First line: first byte is green, second byte is red.
* Second line: first byte is blue, second byte is green. */
CAMERA_BAYER_GRBG,
/* Bayer, each pixel is 1 bytes. 2x2 pixels form a unit.
* First line: first byte is red, second byte is green.
* Second line: first byte is green, second byte is blue. */
CAMERA_BAYER_RGGB,
/* RGB888, each pixel is 3 bytes. R is 8 bits, G is 8 bits,
* B is 8 bits*/
CAMERA_RGB888
} camera_format_type;
typedef enum {
CAMERA_ORIENTATION_LANDSCAPE,
CAMERA_ORIENTATION_PORTRAIT
} camera_orientation_type;
typedef enum {
CAMERA_DESCRIPTION_STRING,
CAMERA_USER_COMMENT_STRING,
CAMERA_GPS_AREA_INFORMATION_STRING
} camera_string_type;
typedef struct {
int32_t buffer[256]; /* buffer to hold data */
int32_t max_value;
} camera_preview_histogram_info;
typedef enum {
CAM_STATS_TYPE_HIST,
CAM_STATS_TYPE_MAX
}camstats_type;
typedef struct {
uint32_t timestamp; /* seconds since 1/6/1980 */
double latitude; /* degrees, WGS ellipsoid */
double longitude; /* degrees */
int16_t altitude; /* meters */
} camera_position_type;
typedef struct {
/* Format of the frame */
camera_format_type format;
/* For pre-V7, Width and height of the picture.
* For V7:
* Snapshot: thumbnail dimension
* Raw Snapshot: not applicable
* Preview: not applicable
*/
uint16_t dx;
uint16_t dy;
/* For pre_V7: For BAYER format, RAW data before scaling.
* For V7:
* Snapshot: Main image dimension
* Raw snapshot: raw image dimension
* Preview: preview image dimension
*/
uint16_t captured_dx;
uint16_t captured_dy;
/* it indicates the degree of clockwise rotation that should be
* applied to obtain the exact view of the captured image. */
uint16_t rotation;
#ifdef FEATURE_CAMERA_V7
/* Preview: not applicable
* Raw shapshot: not applicable
* Snapshot: thumbnail image buffer
*/
uint8_t *thumbnail_image;
#endif /* FEATURE_CAMERA_V7 */
/* For pre-V7:
* Image buffer ptr
* For V7:
* Preview: preview image buffer ptr
* Raw snapshot: Raw image buffer ptr
* Shapshot: Main image buffer ptr
*/
uint8_t *buffer;
} camera_frame_type;
typedef struct {
uint16_t uMode; // Input / Output AAC mode
uint32_t dwFrequency; // Sampling Frequency
uint16_t uQuality; // Audio Quality
uint32_t dwReserved; // Reserved for future use
} camera_aac_encoding_info_type;
typedef enum {
TIFF_DATA_BYTE = 1,
TIFF_DATA_ASCII = 2,
TIFF_DATA_SHORT = 3,
TIFF_DATA_LONG = 4,
TIFF_DATA_RATIONAL = 5,
TIFF_DATA_UNDEFINED = 7,
TIFF_DATA_SLONG = 9,
TIFF_DATA_SRATIONAL = 10
} tiff_data_type;
typedef enum {
ZERO_IFD = 0, /* This must match AEECamera.h */
FIRST_IFD,
EXIF_IFD,
GPS_IFD,
INTEROP_IFD,
DEFAULT_IFD
} camera_ifd_type;
typedef struct {
uint16_t tag_id;
camera_ifd_type ifd;
tiff_data_type type;
uint16_t count;
void *value;
} camera_exif_tag_type;
typedef struct {
/* What is the ID for this sensor */
uint16_t sensor_id;
/* Sensor model number, null terminated, trancate to 31 characters */
char sensor_model[32];
/* Width and height of the sensor */
uint16_t sensor_width;
uint16_t sensor_height;
/* Frames per second */
uint16_t fps;
/* Whether the device driver can sense when sensor is rotated */
int8_t sensor_rotation_sensing;
/* How the sensor are installed */
uint16_t default_rotation;
camera_orientation_type default_orientation;
/*To check antibanding support */
int8_t support_auto_antibanding;
} camera_info_type;
typedef struct {
int32_t quality;
camera_encode_type format;
int32_t file_size;
} camera_encode_properties_type;
typedef enum {
CAMERA_DEVICE_MEM,
CAMERA_DEVICE_EFS,
CAMERA_DEVICE_MAX
} camera_device_type;
#define MAX_JPEG_ENCODE_BUF_NUM 4
#define MAX_JPEG_ENCODE_BUF_LEN (1024*8)
typedef struct {
uint32_t buf_len;/* Length of each buffer */
uint32_t used_len;
int8_t valid;
uint8_t *buffer;
} camera_encode_mem_type;
typedef struct {
camera_device_type device;
#ifndef FEATURE_CAMERA_ENCODE_PROPERTIES
int32_t quality;
camera_encode_type format;
#endif /* nFEATURE_CAMERA_ENCODE_PROPERTIES */
int32_t encBuf_num;
camera_encode_mem_type encBuf[MAX_JPEG_ENCODE_BUF_NUM];
} camera_handle_mem_type;
#ifdef FEATURE_EFS
typedef struct {
camera_device_type device;
#ifndef FEATURE_CAMERA_ENCODE_PROPERTIES
int32_t quality;
camera_encode_type format;
#endif /* nFEATURE_CAMERA_ENCODE_PROPERTIES */
char filename[FS_FILENAME_MAX_LENGTH_P];
} camera_handle_efs_type;
#endif /* FEATURE_EFS */
typedef enum {
CAMERA_PARM_FADE_OFF,
CAMERA_PARM_FADE_IN,
CAMERA_PARM_FADE_OUT,
CAMERA_PARM_FADE_IN_OUT,
CAMERA_PARM_FADE_MAX
} camera_fading_type;
typedef union {
camera_device_type device;
camera_handle_mem_type mem;
} camera_handle_type;
typedef enum {
CAMERA_AUTO_FOCUS,
CAMERA_MANUAL_FOCUS
} camera_focus_e_type;
/* AEC: Frame average weights the whole preview window equally
AEC: Center Weighted weights the middle X percent of the window
X percent compared to the rest of the frame
AEC: Spot metering weights the very center regions 100% and
discounts other areas */
typedef enum {
CAMERA_AEC_FRAME_AVERAGE,
CAMERA_AEC_CENTER_WEIGHTED,
CAMERA_AEC_SPOT_METERING,
CAMERA_AEC_MAX_MODES
} camera_auto_exposure_mode_type;
/* Auto focus mode, used for CAMERA_PARM_AF_MODE */
typedef enum {
AF_MODE_UNCHANGED = -1,
AF_MODE_NORMAL = 0,
AF_MODE_MACRO,
AF_MODE_AUTO,
AF_MODE_MAX
} isp3a_af_mode_t;
/* VFE Focus Region:
* VFE input image dimension
* VFE Focus Window:
* A rectangle in the VFE Focus Region. VFE Focus Window
* area must not exceed one quarter of the area of VFE Focus
* Region.
* Display Focus Region:
* Diplay dimensions (not LCD dimensions)
* Display Focus Window:
* A rectangle in Display Focus Region
* Focus Window Freedom: Movement of Focus Window in x and y direction.
*/
typedef struct {
/* Focus Window dimensions, could be negative. */
int16_t x;
int16_t y;
int16_t dx;
int16_t dy;
/* Focus Window Freedom granularity in x-direction */
int16_t dx_step_size;
/* Focus Window Freedom granularity in y-direction */
int16_t dy_step_size;
/* Focus Window can only move within this Focus Region and
* the maximum Focus Window area must not exceed one quarter of the
* Focus Region.
*/
int16_t min_x;
int16_t min_y;
int16_t max_x;
int16_t max_y;
} camera_focus_window_type;
typedef unsigned int Offline_Input_PixelSizeType;
typedef uint16_t Offline_Snapshot_PixelSizeType;
typedef uint16_t Offline_Thumbnail_PixelSizeType;
typedef uint16_t Offline_NumFragments_For_Input;
typedef uint16_t Offline_NumFragments_For_Output;
typedef struct {
/* Focus Window dimensions */
int16_t x_upper_left;
int16_t y_upper_left;
int16_t width;
int16_t height;
} camera_focus_rectangle_dimensions_type;
typedef struct {
int16_t focus_window_count;
camera_focus_rectangle_dimensions_type *windows_list;
} camera_focus_window_rectangles_type;
typedef enum Offline_InputFormatType {
CAMERA_BAYER_G_B,
CAMERA_BAYER_B_G,
CAMERA_BAYER_G_R,
CAMERA_BAYER_R_G,
CAMERA_YCbCr_Y_Cb_Y_Cr,
CAMERA_YCbCr_Y_Cr_Y_Cb,
CAMERA_YCbCr_Cb_Y_Cr_Y,
CAMERA_YCbCr_Cr_Y_Cb_Y,
CAMERA_YCbCr_4_2_2_linepacked,
CAMERA_YCbCr_4_2_0_linepacked,
CAMERA_NumberOf_InputFormatType /* Used for count purposes only */
} Offline_InputFormatType;
typedef enum Offline_YCbCr_InputCositingType {
CAMERA_CHROMA_NOT_COSITED,
CAMERA_CHROMA_COSITED,
CAMERA_NumberOf_YCbCr_InputCositingType /* Used for count purposes only */
} Offline_YCbCr_InputCositingType;
typedef enum Offline_Input_PixelDataWidthType {
CAMERA_8Bit,
CAMERA_10Bit,
CAMERA_NumberOf_PixelDataWidthType /* Used for count purposes only */
} Offline_Input_PixelDataWidthType;
typedef struct OfflineInputConfigurationType {
Offline_YCbCr_InputCositingType YCbCrCositing ;
Offline_InputFormatType format ;
Offline_Input_PixelDataWidthType dataWidth ;
Offline_Input_PixelSizeType height ;
Offline_Input_PixelSizeType width ;
Offline_Thumbnail_PixelSizeType thumbnail_width ;
Offline_Thumbnail_PixelSizeType thumbnail_height ;
Offline_Snapshot_PixelSizeType snapshot_width ;
Offline_Snapshot_PixelSizeType snapshot_height ;
char* file_name ;
Offline_NumFragments_For_Input input_fragments ;
Offline_NumFragments_For_Output output_fragments ;
} OfflineInputConfigurationType;
/* Enum Type for bracketing support */
typedef enum {
CAMERA_BRACKETING_OFF,
CAMERA_BRACKETING_EXPOSURE,
CAMERA_BRACKETING_MAX
} camera_bracketing_mode_type;
/*
* Best Shot Modes
*
* DESCRIPTION
* When best shot mode is enabled in the service layer, if the
* current mode is on, then it will remember the active parameter
* values. When best shot mode is disabled, the service layer will
* restore parameters that were overwritten when best shot mode was
* enabled.
*
* For example, white balance was set to CAMERA_WB_INCANDESCENT,
* and LANDSCAPE best shot mode is now active, so the active WB
* mode is OUTDOOR:
*
* While LANDSCAPE best shot mode is active:
*
* If application sets WB to FLUORESCENT, then the remembered WB
* mode is FLUORESCENT, but the active WB is still OUTDOOR. When
* best shot mode is disabled, WB is restored to FLUORESCENT.
*
* When the application gets WB parm, the service layer returns
* INCANDESCENT, not OUTDOOR.
*
* SPECIAL EXCEPTIONS
* The service layer will always set EV to 0 upon changing a best shot
* mode. This includes enabling, disabling, and switching bes tshot modes.
* The UI should reflect this setting. The user can then adjust EV.
*
* The service layer will also always set Contrast to the default setting when
* changing best shot modes. This includes enabling, disabling and switching
* best shot modes.
*
* It is recommended that the UI also update EV and Contrast to the default
* values when changing best shot modes.
*
* When the best shot mode specifies AUTO WB the service layer will accept
* and apply any manual WB. When the best shot mode specifies OUTDOOR WB the
* service layer will accept and apply CLOUDY or DAYLIGHT manual WB settings.
* Any other WB settings will be remembered and restored when best shot is
* disabled.
*
* Exposure metering settings may be over written when entering a best shot
* mode. Any user set exposure metering will be applied immediately.
*
* ISO and hand jitter reduction can not be used with a strobe flash. If
* a flash is to be used these features will be disabled.
*
* For BEST SHOT if HJR is ON or a specific ISO setting is specified then
* no ISO/HJR settings will be applied while the best shot mode is
* enabled. If HJR is OFF any ISO setting besides HJR will be accepted.
* If HJR is KEEP CURRENT any ISO setting may be applied provided that
* the best shot ISO setting is auto.
*/
/* This list must match the best shot modes defined in
* camera_bestshot_config.h
*/
typedef enum {
CAMERA_BESTSHOT_OFF = 0,
CAMERA_BESTSHOT_LANDSCAPE = 1,
CAMERA_BESTSHOT_SNOW,
CAMERA_BESTSHOT_BEACH,
CAMERA_BESTSHOT_SUNSET,
CAMERA_BESTSHOT_NIGHT,
CAMERA_BESTSHOT_PORTRAIT,
CAMERA_BESTSHOT_BACKLIGHT,
CAMERA_BESTSHOT_SPORTS,
CAMERA_BESTSHOT_ANTISHAKE,
CAMERA_BESTSHOT_FLOWERS,
CAMERA_BESTSHOT_CANDLELIGHT,
CAMERA_BESTSHOT_FIREWORKS,
CAMERA_BESTSHOT_PARTY,
CAMERA_BESTSHOT_NIGHT_PORTRAIT,