1 /*
2 ** Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
3 ** Not a Contribution. Apache license notifications and license are
4 ** retained for attribution purposes only.
5 **
6 ** Copyright 2008, The Android Open Source Project
7 ** Licensed under the Apache License, Version 2.0 (the "License");
8 ** you may not use this file except in compliance with the License.
9 ** You may obtain a copy of the License at
10 **
11 **     http://www.apache.org/licenses/LICENSE-2.0
12 **
13 ** Unless required by applicable law or agreed to in writing, software
14 ** distributed under the License is distributed on an "AS IS" BASIS,
15 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 ** See the License for the specific language governing permissions and
17 ** limitations under the License.
18 */
19 
20 #ifndef ANDROID_HARDWARE_QCAMERA_PARAMETERS_H
21 #define ANDROID_HARDWARE_QCAMERA_PARAMETERS_H
22 
23 // To remove
24 #include <cutils/properties.h>
25 
26 // System dependencies
27 #include <camera/CameraParameters.h>
28 #include <utils/Errors.h>
29 
30 // Camera dependencies
31 #include "camera.h"
32 #include "QCameraMem.h"
33 #include "QCameraParametersIntf.h"
34 #include "QCameraThermalAdapter.h"
35 #include "QCameraCommon.h"
36 
37 extern "C" {
38 #include "mm_jpeg_interface.h"
39 }
40 
41 using namespace android;
42 
43 namespace qcamera {
44 
45 //EXIF globals
46 static const char ExifAsciiPrefix[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 };          // "ASCII\0\0\0"
47 static const char ExifUndefinedPrefix[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };   // "\0\0\0\0\0\0\0\0"
48 
49 #define FOCAL_LENGTH_DECIMAL_PRECISION   100
50 
51 #define CAMERA_MIN_BATCH_COUNT           4
52 
53 #define QCAMERA_MAX_EXP_TIME_LEVEL1      100
54 #define QCAMERA_MAX_EXP_TIME_LEVEL2      500
55 #define QCAMERA_MAX_EXP_TIME_LEVEL3      1000
56 #define QCAMERA_MAX_EXP_TIME_LEVEL4      10000
57 
58 class QCameraParameters: private CameraParameters
59 {
60 
61 private:
62 
63     class QCameraReprocScaleParam{
64     public:
65 
66         QCameraReprocScaleParam();
67         ~QCameraReprocScaleParam();
68 
69         void setScaleEnable(bool enabled);
70         int32_t setScaleSizeTbl(size_t scale_cnt,
71                 cam_dimension_t *scale_tbl, size_t org_cnt,
72                 cam_dimension_t *org_tbl);
73         int32_t setValidatePicSize(int &width, int &height);
74 
75         bool isScaleEnabled();
76         bool isUnderScaling();
77 
78         size_t getScaleSizeTblCnt();
79         cam_dimension_t *getScaledSizeTbl();
80         size_t getTotalSizeTblCnt();
81         cam_dimension_t *getTotalSizeTbl();
82         int32_t getPicSizeFromAPK(int &width, int &height);
83         int32_t getPicSizeSetted(int &width, int &height);
84 
85     private:
86         bool isScalePicSize(int width, int height);
87         bool isValidatePicSize(int width, int height);
88         int32_t setSensorSupportedPicSize();
89         size_t checkScaleSizeTable(size_t scale_cnt, cam_dimension_t *scale_tbl,
90                 size_t org_cnt, cam_dimension_t *org_tbl);
91 
92         bool mScaleEnabled;
93         bool mIsUnderScaling;   //if in scale status
94 
95         // picture size cnt that need scale operation
96         size_t mNeedScaleCnt;
97         cam_dimension_t mNeedScaledSizeTbl[MAX_SCALE_SIZES_CNT];
98 
99         // sensor supported size cnt and table
100         size_t mSensorSizeTblCnt;
101         cam_dimension_t *mSensorSizeTbl;
102 
103         // Total size cnt (sensor supported + need scale cnt)
104         size_t mTotalSizeTblCnt;
105         cam_dimension_t mTotalSizeTbl[MAX_SIZES_CNT];
106 
107         cam_dimension_t mPicSizeFromAPK;   // dimension that APK is expected
108         cam_dimension_t mPicSizeSetted;    // dimension that config vfe
109     };
110 
111     // Supported PREVIEW/RECORDING SIZES IN HIGH FRAME RATE recording, sizes in pixels.
112     // Example value: "800x480,432x320". Read only.
113     static const char KEY_QC_SUPPORTED_HFR_SIZES[];
114     // The mode of preview frame rate.
115     // Example value: "frame-rate-auto, frame-rate-fixed".
116     static const char KEY_QC_PREVIEW_FRAME_RATE_MODE[];
117     static const char KEY_QC_SUPPORTED_PREVIEW_FRAME_RATE_MODES[];
118     static const char KEY_QC_PREVIEW_FRAME_RATE_AUTO_MODE[];
119     static const char KEY_QC_PREVIEW_FRAME_RATE_FIXED_MODE[];
120     static const char KEY_QC_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] ;
121 
122     // Supported live snapshot sizes
123     static const char KEY_QC_SUPPORTED_LIVESNAPSHOT_SIZES[];
124 
125     // Supported Raw formats
126     static const char KEY_QC_SUPPORTED_RAW_FORMATS[];
127     static const char KEY_QC_RAW_FORMAT[];
128 
129     //Touch Af/AEC settings.
130     static const char KEY_QC_TOUCH_AF_AEC[];
131     static const char KEY_QC_SUPPORTED_TOUCH_AF_AEC[];
132     //Touch Index for AEC.
133     static const char KEY_QC_TOUCH_INDEX_AEC[];
134     //Touch Index for AF.
135     static const char KEY_QC_TOUCH_INDEX_AF[];
136     // Current auto scene detection mode.
137     // Example value: "off" or "on" constants. Read/write.
138     static const char KEY_QC_SCENE_DETECT[];
139     // Supported auto scene detection settings.
140     // Example value: "off,on". Read only.
141     static const char KEY_QC_SUPPORTED_SCENE_DETECT[];
142     static const char KEY_QC_SELECTABLE_ZONE_AF[];
143 
144     static const char KEY_QC_ISO_MODE[];
145     static const char KEY_QC_CONTINUOUS_ISO[];
146     static const char KEY_QC_MIN_ISO[];
147     static const char KEY_QC_MAX_ISO[];
148     static const char KEY_QC_SUPPORTED_ISO_MODES[];
149     static const char KEY_QC_EXPOSURE_TIME[];
150     static const char KEY_QC_MIN_EXPOSURE_TIME[];
151     static const char KEY_QC_MAX_EXPOSURE_TIME[];
152     static const char KEY_QC_LENSSHADE[] ;
153     static const char KEY_QC_SUPPORTED_LENSSHADE_MODES[] ;
154     static const char KEY_QC_AUTO_EXPOSURE[];
155     static const char KEY_QC_SUPPORTED_AUTO_EXPOSURE[];
156 
157     static const char KEY_QC_GPS_LATITUDE_REF[];
158     static const char KEY_QC_GPS_LONGITUDE_REF[];
159     static const char KEY_QC_GPS_ALTITUDE_REF[];
160     static const char KEY_QC_GPS_STATUS[];
161     static const char KEY_QC_MEMORY_COLOR_ENHANCEMENT[];
162     static const char KEY_QC_SUPPORTED_MEM_COLOR_ENHANCE_MODES[];
163     static const char KEY_QC_DIS[];
164     static const char KEY_QC_OIS[];
165     static const char KEY_QC_SUPPORTED_DIS_MODES[];
166     static const char KEY_QC_SUPPORTED_OIS_MODES[];
167 
168     static const char KEY_QC_ZSL[];
169     static const char KEY_QC_SUPPORTED_ZSL_MODES[];
170     static const char KEY_QC_ZSL_BURST_INTERVAL[];
171     static const char KEY_QC_ZSL_BURST_LOOKBACK[];
172     static const char KEY_QC_ZSL_QUEUE_DEPTH[];
173 
174     static const char KEY_QC_CAMERA_MODE[];
175     static const char KEY_QC_ORIENTATION[];
176 
177     static const char KEY_QC_VIDEO_HIGH_FRAME_RATE[];
178     static const char KEY_QC_VIDEO_HIGH_SPEED_RECORDING[];
179     static const char KEY_QC_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[];
180     static const char KEY_QC_HIGH_DYNAMIC_RANGE_IMAGING[];
181     static const char KEY_QC_SUPPORTED_HDR_IMAGING_MODES[];
182     static const char KEY_QC_AE_BRACKET_HDR[];
183     static const char KEY_QC_SUPPORTED_AE_BRACKET_MODES[];
184     static const char KEY_QC_CAPTURE_BURST_EXPOSURE[];
185     static const char KEY_QC_NUM_SNAPSHOT_PER_SHUTTER[];
186     static const char KEY_QC_NUM_RETRO_BURST_PER_SHUTTER[];
187     static const char KEY_QC_SNAPSHOT_BURST_LED_ON_PERIOD[];
188     static const char KEY_QC_SNAPSHOT_BURST_NUM[];
189     static const char KEY_QC_NO_DISPLAY_MODE[];
190     static const char KEY_QC_RAW_PICUTRE_SIZE[];
191     static const char KEY_QC_TINTLESS_ENABLE[];
192     static const char KEY_QC_SCENE_SELECTION[];
193     static const char KEY_QC_CDS_MODE[];
194     static const char KEY_QC_VIDEO_CDS_MODE[];
195     static const char KEY_QC_SUPPORTED_CDS_MODES[];
196     static const char KEY_QC_SUPPORTED_VIDEO_CDS_MODES[];
197     static const char KEY_QC_TNR_MODE[];
198     static const char KEY_QC_VIDEO_TNR_MODE[];
199     static const char KEY_QC_SUPPORTED_TNR_MODES[];
200     static const char KEY_QC_SUPPORTED_VIDEO_TNR_MODES[];
201 
202     static const char KEY_INTERNAL_PERVIEW_RESTART[];
203     static const char KEY_QC_WB_MANUAL_CCT[];
204     static const char KEY_QC_MIN_WB_CCT[];
205     static const char KEY_QC_MAX_WB_CCT[];
206     static const char KEY_QC_MANUAL_WB_GAINS[];
207     static const char KEY_QC_MIN_WB_GAIN[];
208     static const char KEY_QC_MAX_WB_GAIN[];
209     static const char WHITE_BALANCE_MANUAL[];
210     static const char FOCUS_MODE_MANUAL_POSITION[];
211     static const char KEY_QC_LONG_SHOT[];
212     static const char KEY_QC_INITIAL_EXPOSURE_INDEX[];
213     static const char KEY_QC_INSTANT_AEC[];
214     static const char KEY_QC_INSTANT_CAPTURE[];
215     static const char KEY_QC_INSTANT_AEC_SUPPORTED_MODES[];
216     static const char KEY_QC_INSTANT_CAPTURE_SUPPORTED_MODES[];
217 
218     static const char KEY_QC_MANUAL_FOCUS_POSITION[];
219     static const char KEY_QC_MANUAL_FOCUS_POS_TYPE[];
220     static const char KEY_QC_MIN_FOCUS_POS_INDEX[];
221     static const char KEY_QC_MAX_FOCUS_POS_INDEX[];
222     static const char KEY_QC_MIN_FOCUS_POS_DAC[];
223     static const char KEY_QC_MAX_FOCUS_POS_DAC[];
224     static const char KEY_QC_MIN_FOCUS_POS_RATIO[];
225     static const char KEY_QC_MAX_FOCUS_POS_RATIO[];
226     static const char KEY_QC_MIN_FOCUS_POS_DIOPTER[];
227     static const char KEY_QC_MAX_FOCUS_POS_DIOPTER[];
228     static const char KEY_QC_FOCUS_POSITION_SCALE[];
229     static const char KEY_QC_FOCUS_POSITION_DIOPTER[];
230 
231     static const char KEY_QC_SUPPORTED_MANUAL_FOCUS_MODES[];
232     static const char KEY_QC_SUPPORTED_MANUAL_EXPOSURE_MODES[];
233     static const char KEY_QC_SUPPORTED_MANUAL_WB_MODES[];
234     static const char KEY_QC_FOCUS_SCALE_MODE[];
235     static const char KEY_QC_FOCUS_DIOPTER_MODE[];
236     static const char KEY_QC_ISO_PRIORITY[];
237     static const char KEY_QC_EXP_TIME_PRIORITY[];
238     static const char KEY_QC_USER_SETTING[];
239     static const char KEY_QC_WB_CCT_MODE[];
240     static const char KEY_QC_WB_GAIN_MODE[];
241     static const char KEY_QC_MANUAL_WB_TYPE[];
242     static const char KEY_QC_MANUAL_WB_VALUE[];
243     static const char KEY_QC_CURRENT_EXPOSURE_TIME[];
244     static const char KEY_QC_CURRENT_ISO[];
245     static const char KEY_QC_CACHE_VIDEO_BUFFERS[];
246 
247     // DENOISE
248     static const char KEY_QC_DENOISE[];
249     static const char KEY_QC_SUPPORTED_DENOISE[];
250 
251     //Selectable zone AF.
252     static const char KEY_QC_FOCUS_ALGO[];
253     static const char KEY_QC_SUPPORTED_FOCUS_ALGOS[];
254 
255     //Face Detection
256     static const char KEY_QC_FACE_DETECTION[];
257     static const char KEY_QC_SUPPORTED_FACE_DETECTION[];
258 
259     //Face Recognition
260     static const char KEY_QC_FACE_RECOGNITION[];
261     static const char KEY_QC_SUPPORTED_FACE_RECOGNITION[];
262 
263     //Indicates number of faces requested by the application.
264     //This value will be rejected if the requested faces
265     //greater than supported by hardware.
266     //Write only.
267     static const char KEY_QC_MAX_NUM_REQUESTED_FACES[];
268 
269     //preview flip
270     static const char KEY_QC_PREVIEW_FLIP[];
271     //video flip
272     static const char KEY_QC_VIDEO_FLIP[];
273     //snapshot picture flip
274     static const char KEY_QC_SNAPSHOT_PICTURE_FLIP[];
275 
276     static const char KEY_QC_SUPPORTED_FLIP_MODES[];
277 
278     //Face Detection, Facial processing requirement
279     static const char KEY_QC_SNAPSHOT_FD_DATA[];
280 
281     //Auto HDR enable
282     static const char KEY_QC_AUTO_HDR_ENABLE[];
283     // video rotation
284     static const char KEY_QC_VIDEO_ROTATION[];
285     static const char KEY_QC_SUPPORTED_VIDEO_ROTATION_VALUES[];
286 
287     //Redeye Reduction
288     static const char KEY_QC_REDEYE_REDUCTION[];
289     static const char KEY_QC_SUPPORTED_REDEYE_REDUCTION[];
290     static const char EFFECT_EMBOSS[];
291     static const char EFFECT_SKETCH[];
292     static const char EFFECT_NEON[];
293     static const char EFFECT_BEAUTY[];
294 
295     //AF Bracketing
296     static const char KEY_QC_AF_BRACKET[];
297     static const char KEY_QC_SUPPORTED_AF_BRACKET_MODES[];
298 
299     //Refocus
300     static const char KEY_QC_RE_FOCUS[];
301     static const char KEY_QC_SUPPORTED_RE_FOCUS_MODES[];
302 
303     //Chroma Flash
304     static const char KEY_QC_CHROMA_FLASH[];
305     static const char KEY_QC_SUPPORTED_CHROMA_FLASH_MODES[];
306 
307     //Opti Zoom
308     static const char KEY_QC_OPTI_ZOOM[];
309     static const char KEY_QC_SUPPORTED_OPTI_ZOOM_MODES[];
310 
311     // Auto HDR supported
312     static const char KEY_QC_AUTO_HDR_SUPPORTED[];
313 
314     // HDR modes
315     static const char KEY_QC_HDR_MODE[];
316     static const char KEY_QC_SUPPORTED_KEY_QC_HDR_MODES[];
317 
318     //True Portrait
319     static const char KEY_QC_TRUE_PORTRAIT[];
320     static const char KEY_QC_SUPPORTED_TRUE_PORTRAIT_MODES[];
321 
322     //See more
323     static const char KEY_QC_SEE_MORE[];
324     static const char KEY_QC_SUPPORTED_SEE_MORE_MODES[];
325 
326     //Still more
327     static const char KEY_QC_STILL_MORE[];
328     static const char KEY_QC_SUPPORTED_STILL_MORE_MODES[];
329 
330     //Noise reduction mode
331     static const char KEY_QC_NOISE_REDUCTION_MODE[];
332     static const char KEY_QC_NOISE_REDUCTION_MODE_VALUES[];
333 
334     //Longshot
335     static const char KEY_QC_LONGSHOT_SUPPORTED[];
336 
337     //ZSL+HDR
338     static const char KEY_QC_ZSL_HDR_SUPPORTED[];
339 
340     // Values for Touch AF/AEC
341     static const char TOUCH_AF_AEC_OFF[];
342     static const char TOUCH_AF_AEC_ON[];
343 
344     // Values for Scene mode
345     static const char SCENE_MODE_ASD[];
346     static const char SCENE_MODE_BACKLIGHT[];
347     static const char SCENE_MODE_FLOWERS[];
348     static const char SCENE_MODE_AR[];
349     static const char SCENE_MODE_HDR[];
350     static const char PIXEL_FORMAT_YUV420SP_ADRENO[]; // ADRENO
351     static const char PIXEL_FORMAT_YV12[]; // NV12
352     static const char PIXEL_FORMAT_NV12[]; //NV12
353     static const char QC_PIXEL_FORMAT_NV12_VENUS[]; //NV12 VENUS
354 
355     // Values for raw picture format
356     static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_YUYV[];
357     static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_YVYU[];
358     static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_UYVY[];
359     static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_VYUY[];
360     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GBRG[];
361     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GRBG[];
362     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8RGGB[];
363     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8BGGR[];
364     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GBRG[];
365     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GRBG[];
366     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10RGGB[];
367     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10BGGR[];
368     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GBRG[];
369     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GRBG[];
370     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12RGGB[];
371     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12BGGR[];
372     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14GBRG[];
373     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14GRBG[];
374     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14RGGB[];
375     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14BGGR[];
376     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GBRG[];
377     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GRBG[];
378     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8RGGB[];
379     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8BGGR[];
380     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GBRG[];
381     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GRBG[];
382     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10RGGB[];
383     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10BGGR[];
384     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GBRG[];
385     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GRBG[];
386     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12RGGB[];
387     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12BGGR[];
388     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14GBRG[];
389     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14GRBG[];
390     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14RGGB[];
391     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14BGGR[];
392     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GBRG[];
393     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GRBG[];
394     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8RGGB[];
395     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8BGGR[];
396     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GBRG[];
397     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GRBG[];
398     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10RGGB[];
399     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10BGGR[];
400     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GBRG[];
401     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GRBG[];
402     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12RGGB[];
403     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12BGGR[];
404     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14GBRG[];
405     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14GRBG[];
406     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14RGGB[];
407     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14BGGR[];
408     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GBRG[];
409     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GRBG[];
410     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8RGGB[];
411     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8BGGR[];
412     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GBRG[];
413     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GRBG[];
414     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10RGGB[];
415     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10BGGR[];
416     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GBRG[];
417     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GRBG[];
418     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12RGGB[];
419     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12BGGR[];
420     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14GBRG[];
421     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14GRBG[];
422     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14RGGB[];
423     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14BGGR[];
424     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GBRG[];
425     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GRBG[];
426     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8RGGB[];
427     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8BGGR[];
428     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GBRG[];
429     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GRBG[];
430     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8RGGB[];
431     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8BGGR[];
432     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GBRG[];
433     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GRBG[];
434     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10RGGB[];
435     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10BGGR[];
436     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GBRG[];
437     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GRBG[];
438     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12RGGB[];
439     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12BGGR[];
440     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14GBRG[];
441     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14GRBG[];
442     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14RGGB[];
443     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14BGGR[];
444 
445     // ISO values
446     static const char ISO_AUTO[];
447     static const char ISO_HJR[];
448     static const char ISO_100[];
449     static const char ISO_200[];
450     static const char ISO_400[];
451     static const char ISO_800[];
452     static const char ISO_1600[];
453     static const char ISO_3200[];
454     static const char ISO_MANUAL[];
455 
456     // Values for auto exposure settings.
457     static const char AUTO_EXPOSURE_FRAME_AVG[];
458     static const char AUTO_EXPOSURE_CENTER_WEIGHTED[];
459     static const char AUTO_EXPOSURE_SPOT_METERING[];
460     static const char AUTO_EXPOSURE_SMART_METERING[];
461     static const char AUTO_EXPOSURE_USER_METERING[];
462     static const char AUTO_EXPOSURE_SPOT_METERING_ADV[];
463     static const char AUTO_EXPOSURE_CENTER_WEIGHTED_ADV[];
464 
465     // Values for instant AEC modes
466     static const char KEY_QC_INSTANT_AEC_DISABLE[];
467     static const char KEY_QC_INSTANT_AEC_AGGRESSIVE_AEC[];
468     static const char KEY_QC_INSTANT_AEC_FAST_AEC[];
469 
470     // Values for instant capture modes
471     static const char KEY_QC_INSTANT_CAPTURE_DISABLE[];
472     static const char KEY_QC_INSTANT_CAPTURE_AGGRESSIVE_AEC[];
473     static const char KEY_QC_INSTANT_CAPTURE_FAST_AEC[];
474 
475     static const char KEY_QC_SHARPNESS[];
476     static const char KEY_QC_MIN_SHARPNESS[];
477     static const char KEY_QC_MAX_SHARPNESS[];
478     static const char KEY_QC_SHARPNESS_STEP[];
479     static const char KEY_QC_CONTRAST[];
480     static const char KEY_QC_MIN_CONTRAST[];
481     static const char KEY_QC_MAX_CONTRAST[];
482     static const char KEY_QC_CONTRAST_STEP[];
483     static const char KEY_QC_SATURATION[];
484     static const char KEY_QC_MIN_SATURATION[];
485     static const char KEY_QC_MAX_SATURATION[];
486     static const char KEY_QC_SATURATION_STEP[];
487     static const char KEY_QC_BRIGHTNESS[];
488     static const char KEY_QC_MIN_BRIGHTNESS[];
489     static const char KEY_QC_MAX_BRIGHTNESS[];
490     static const char KEY_QC_BRIGHTNESS_STEP[];
491     static const char KEY_QC_SCE_FACTOR[];
492     static const char KEY_QC_MIN_SCE_FACTOR[];
493     static const char KEY_QC_MAX_SCE_FACTOR[];
494     static const char KEY_QC_SCE_FACTOR_STEP[];
495 
496     static const char KEY_QC_HISTOGRAM[] ;
497     static const char KEY_QC_SUPPORTED_HISTOGRAM_MODES[] ;
498     static const char KEY_QC_SUPPORTED_HDR_NEED_1X[];
499     static const char KEY_QC_HDR_NEED_1X[];
500     static const char KEY_QC_VIDEO_HDR[];
501     static const char KEY_QC_VT_ENABLE[];
502     static const char KEY_QC_SUPPORTED_VIDEO_HDR_MODES[];
503     static const char KEY_QC_SENSOR_HDR[];
504     static const char KEY_QC_SUPPORTED_SENSOR_HDR_MODES[];
505     static const char KEY_QC_RDI_MODE[];
506     static const char KEY_QC_SUPPORTED_RDI_MODES[];
507     static const char KEY_QC_SECURE_MODE[];
508     static const char KEY_QC_SUPPORTED_SECURE_MODES[];
509 
510     // Values for SKIN TONE ENHANCEMENT
511     static const char SKIN_TONE_ENHANCEMENT_ENABLE[] ;
512     static const char SKIN_TONE_ENHANCEMENT_DISABLE[] ;
513 
514     // Values for Denoise
515     static const char DENOISE_OFF[] ;
516     static const char DENOISE_ON[] ;
517 
518     // Values for auto exposure settings.
519     static const char FOCUS_ALGO_AUTO[];
520     static const char FOCUS_ALGO_SPOT_METERING[];
521     static const char FOCUS_ALGO_CENTER_WEIGHTED[];
522     static const char FOCUS_ALGO_FRAME_AVERAGE[];
523 
524     // Values for AE Bracketing settings.
525     static const char AE_BRACKET_OFF[];
526     static const char AE_BRACKET[];
527 
528     // Values for AF Bracketing settings.
529     static const char AF_BRACKET_OFF[];
530     static const char AF_BRACKET_ON[];
531 
532     // Values for Refocus settings.
533     static const char RE_FOCUS_OFF[];
534     static const char RE_FOCUS_ON[];
535 
536     // Values for Chroma Flash settings.
537     static const char CHROMA_FLASH_OFF[];
538     static const char CHROMA_FLASH_ON[];
539 
540     // Values for Opti Zoom settings.
541     static const char OPTI_ZOOM_OFF[];
542     static const char OPTI_ZOOM_ON[];
543 
544     // Values for Still More settings.
545     static const char STILL_MORE_OFF[];
546     static const char STILL_MORE_ON[];
547 
548     // Values for HDR mode settings.
549     static const char HDR_MODE_SENSOR[];
550     static const char HDR_MODE_MULTI_FRAME[];
551 
552     // Values for True Portrait settings.
553     static const char TRUE_PORTRAIT_OFF[];
554     static const char TRUE_PORTRAIT_ON[];
555 
556     // Values for HFR settings.
557     static const char VIDEO_HFR_OFF[];
558     static const char VIDEO_HFR_2X[];
559     static const char VIDEO_HFR_3X[];
560     static const char VIDEO_HFR_4X[];
561     static const char VIDEO_HFR_5X[];
562     static const char VIDEO_HFR_6X[];
563     static const char VIDEO_HFR_7X[];
564     static const char VIDEO_HFR_8X[];
565     static const char VIDEO_HFR_9X[];
566 
567     // Values for feature on/off settings.
568     static const char VALUE_OFF[];
569     static const char VALUE_ON[];
570 
571     // Values for feature enable/disable settings.
572     static const char VALUE_ENABLE[];
573     static const char VALUE_DISABLE[];
574 
575     // Values for feature true/false settings.
576     static const char VALUE_FALSE[];
577     static const char VALUE_TRUE[];
578 
579     //Values for flip settings
580     static const char FLIP_MODE_OFF[];
581     static const char FLIP_MODE_V[];
582     static const char FLIP_MODE_H[];
583     static const char FLIP_MODE_VH[];
584 
585     //Values for CDS Mode
586     static const char CDS_MODE_OFF[];
587     static const char CDS_MODE_ON[];
588     static const char CDS_MODE_AUTO[];
589 
590     static const char VALUE_FAST[];
591     static const char VALUE_HIGH_QUALITY[];
592 
593     static const char KEY_SELECTED_AUTO_SCENE[];
594 
595     // Values for Video rotation
596     static const char VIDEO_ROTATION_0[];
597     static const char VIDEO_ROTATION_90[];
598     static const char VIDEO_ROTATION_180[];
599     static const char VIDEO_ROTATION_270[];
600 
601 #ifdef TARGET_TS_MAKEUP
602     static const char KEY_TS_MAKEUP[];
603     static const char KEY_TS_MAKEUP_WHITEN[];
604     static const char KEY_TS_MAKEUP_CLEAN[];
605 #endif
606     //param key for HFR batch size
607     static const char KEY_QC_VIDEO_BATCH_SIZE[];
608     enum {
609         CAMERA_ORIENTATION_UNKNOWN = 0,
610         CAMERA_ORIENTATION_PORTRAIT = 1,
611         CAMERA_ORIENTATION_LANDSCAPE = 2,
612     };
613 
614     template <typename valueType> struct QCameraMap {
615         const char *const desc;
616         valueType val;
617     };
618 
619 public:
620     QCameraParameters();
621     QCameraParameters(const String8 &params);
622     ~QCameraParameters();
623 
624     int32_t allocate();
625     int32_t init(cam_capability_t *,
626                  mm_camera_vtbl_t *,
627                  QCameraAdjustFPS *);
628     void deinit();
629     int32_t initDefaultParameters();
630     int32_t updateParameters(const String8& params, bool &needRestart);
631     int32_t commitParameters();
632 
633     char* getParameters();
getPreviewFpsRange(int * min_fps,int * max_fps)634     void getPreviewFpsRange(int *min_fps, int *max_fps) const {
635             CameraParameters::getPreviewFpsRange(min_fps, max_fps);
636     }
637 #ifdef TARGET_TS_MAKEUP
638     bool getTsMakeupInfo(int &whiteLevel, int &cleanLevel) const;
639 #endif
640 
641     int getPreviewHalPixelFormat();
642     int32_t getStreamRotation(cam_stream_type_t streamType,
643                                cam_pp_feature_config_t &featureConfig,
644                                cam_dimension_t &dim);
645     int32_t getStreamFormat(cam_stream_type_t streamType,
646                              cam_format_t &format);
647     int32_t getStreamDimension(cam_stream_type_t streamType,
648             cam_dimension_t &dim);
649     void getThumbnailSize(int *width, int *height) const;
650 
651 
652     uint8_t getZSLBurstInterval();
653     uint8_t getZSLQueueDepth();
654     uint8_t getZSLBackLookCount();
655     uint8_t getMaxUnmatchedFramesInQueue();
isZSLMode()656     bool isZSLMode() {return m_bZslMode;};
isRdiMode()657     bool isRdiMode() {return m_bRdiMode;};
isSecureMode()658     bool isSecureMode() {return m_bSecureMode;};
isNoDisplayMode()659     bool isNoDisplayMode() {return m_bNoDisplayMode;};
isWNREnabled()660     bool isWNREnabled() {return m_bWNROn;};
isTNRSnapshotEnabled()661     bool isTNRSnapshotEnabled() {return m_bTNRSnapshotOn;};
getCDSMode()662     int32_t getCDSMode() {return mCds_mode;};
isLTMForSeeMoreEnabled()663     bool isLTMForSeeMoreEnabled() {return m_bLtmForSeeMoreEnabled;};
isHfrMode()664     bool isHfrMode() {return m_bHfrMode;};
getHfrFps(cam_fps_range_t & pFpsRange)665     void getHfrFps(cam_fps_range_t &pFpsRange) { pFpsRange = m_hfrFpsRange;};
666     uint8_t getNumOfSnapshots();
667     uint8_t getNumOfRetroSnapshots();
668     uint8_t getNumOfExtraHDRInBufsIfNeeded();
669     uint8_t getNumOfExtraHDROutBufsIfNeeded();
670 
getRecordingHintValue()671     bool getRecordingHintValue() {return m_bRecordingHint;}; // return local copy of video hint
672     uint32_t getJpegQuality();
673     uint32_t getRotation();
674     uint32_t getDeviceRotation();
675     uint32_t getJpegExifRotation();
676     bool useJpegExifRotation();
677     int32_t getEffectValue();
isInstantAECEnabled()678     bool isInstantAECEnabled() {return m_bInstantAEC;};
isInstantCaptureEnabled()679     bool isInstantCaptureEnabled() {return m_bInstantCapture;};
getAecFrameBoundValue()680     uint8_t getAecFrameBoundValue() {return mAecFrameBound;};
getAecSkipDisplayFrameBound()681     uint8_t getAecSkipDisplayFrameBound() {return mAecSkipDisplayFrameBound;};
682 
683     int32_t getExifDateTime(String8 &dateTime, String8 &subsecTime);
684     int32_t getExifFocalLength(rat_t *focalLenght);
685     uint16_t getExifIsoSpeed();
686     int32_t getExifGpsProcessingMethod(char *gpsProcessingMethod, uint32_t &count);
687     int32_t getExifLatitude(rat_t *latitude, char *latRef);
688     int32_t getExifLongitude(rat_t *longitude, char *lonRef);
689     int32_t getExifAltitude(rat_t *altitude, char *altRef);
690     int32_t getExifGpsDateTimeStamp(char *gpsDateStamp, uint32_t bufLen, rat_t *gpsTimeStamp);
691     bool isVideoBuffersCached();
692     int32_t updateFocusDistances(cam_focus_distances_info_t *focusDistances);
693 
694     bool isAEBracketEnabled();
695     int32_t setAEBracketing();
isFpsDebugEnabled()696     bool isFpsDebugEnabled() {return m_bDebugFps;};
isHistogramEnabled()697     bool isHistogramEnabled() {return m_bHistogramEnabled;};
isSceneSelectionEnabled()698     bool isSceneSelectionEnabled() {return m_bSceneSelection;};
699     int32_t setSelectedScene(cam_scene_mode_type scene);
700     cam_scene_mode_type getSelectedScene();
isFaceDetectionEnabled()701     bool isFaceDetectionEnabled() {return ((m_nFaceProcMask &
702             (CAM_FACE_PROCESS_MASK_DETECTION | CAM_FACE_PROCESS_MASK_FOCUS)) != 0);};
703     int32_t setFaceDetectionOption(bool enabled);
704     int32_t setHistogram(bool enabled);
705     int32_t setFaceDetection(bool enabled, bool initCommit);
706     int32_t setFrameSkip(enum msm_vfe_frame_skip_pattern pattern);
getThermalMode()707     qcamera_thermal_mode getThermalMode() {return m_ThermalMode;};
708     int32_t updateRecordingHintValue(int32_t value);
709     int32_t setHDRAEBracket(cam_exp_bracketing_t hdrBracket);
710     bool isHDREnabled();
711     bool isAutoHDREnabled();
712     int32_t stopAEBracket();
713     int32_t updateRAW(cam_dimension_t max_dim);
714     bool isDISEnabled();
715     cam_is_type_t getISType();
716     uint8_t getMobicatMask();
717 
getFocusMode()718     cam_focus_mode_type getFocusMode() const {return mFocusMode;};
719     int32_t setNumOfSnapshot();
720     int32_t adjustPreviewFpsRange(cam_fps_range_t *fpsRange);
isJpegPictureFormat()721     bool isJpegPictureFormat() {return (mPictureFormat == CAM_FORMAT_JPEG);};
isNV16PictureFormat()722     bool isNV16PictureFormat() {return (mPictureFormat == CAM_FORMAT_YUV_422_NV16);};
isNV21PictureFormat()723     bool isNV21PictureFormat() {return (mPictureFormat == CAM_FORMAT_YUV_420_NV21);};
724     cam_denoise_process_type_t getDenoiseProcessPlate(cam_intf_parm_type_t type);
getMaxPicSize(cam_dimension_t & dim)725     int32_t getMaxPicSize(cam_dimension_t &dim) { dim = m_maxPicSize; return NO_ERROR; };
726     int getFlipMode(cam_stream_type_t streamType);
727     bool isSnapshotFDNeeded();
728 
isHDR1xFrameEnabled()729     bool isHDR1xFrameEnabled() {return m_bHDR1xFrameEnabled;}
730     bool isSupportedSensorHdrSize(const QCameraParameters& params);
731     bool isYUVFrameInfoNeeded();
732     const char*getFrameFmtString(cam_format_t fmt);
isHDR1xExtraBufferNeeded()733     bool isHDR1xExtraBufferNeeded() {return m_bHDR1xExtraBufferNeeded;}
isHDROutputCropEnabled()734     bool isHDROutputCropEnabled() {return m_bHDROutputCropEnabled;}
735 
isPreviewFlipChanged()736     bool isPreviewFlipChanged() { return m_bPreviewFlipChanged; };
isVideoFlipChanged()737     bool isVideoFlipChanged() { return m_bVideoFlipChanged; };
isSnapshotFlipChanged()738     bool isSnapshotFlipChanged() { return m_bSnapshotFlipChanged; };
739     void setHDRSceneEnable(bool bflag);
740     int32_t updateAWBParams(cam_awb_params_t &awb_params);
741 
742     const char *getASDStateString(cam_auto_scene_t scene);
isHDRThumbnailProcessNeeded()743     bool isHDRThumbnailProcessNeeded() { return m_bHDRThumbnailProcessNeeded; };
setMinPpMask(cam_feature_mask_t min_pp_mask)744     void setMinPpMask(cam_feature_mask_t min_pp_mask) { m_nMinRequiredPpMask = min_pp_mask; };
745     bool setStreamConfigure(bool isCapture, bool previewAsPostview, bool resetConfig);
746     int32_t addOnlineRotation(uint32_t rotation, uint32_t streamId, int32_t device_rotation);
747     uint8_t getNumOfExtraBuffersForImageProc();
748     uint8_t getNumOfExtraBuffersForVideo();
749     uint8_t getNumOfExtraBuffersForPreview();
750     uint32_t getExifBufIndex(uint32_t captureIndex);
751     bool needThumbnailReprocess(cam_feature_mask_t *pFeatureMask);
isUbiFocusEnabled()752     inline bool isUbiFocusEnabled() {return m_bAFBracketingOn && !m_bReFocusOn;};
isChromaFlashEnabled()753     inline bool isChromaFlashEnabled() {return m_bChromaFlashOn;};
isHighQualityNoiseReductionMode()754     inline bool isHighQualityNoiseReductionMode() {return m_bHighQualityNoiseReductionMode;};
isTruePortraitEnabled()755     inline bool isTruePortraitEnabled() {return m_bTruePortraitOn;};
getTPMaxMetaSize()756     inline size_t getTPMaxMetaSize() {
757         return m_pCapability->true_portrait_settings_need.meta_max_size;};
isSeeMoreEnabled()758     inline bool isSeeMoreEnabled() {return m_bSeeMoreOn;};
isStillMoreEnabled()759     inline bool isStillMoreEnabled() {return m_bStillMoreOn;};
760     bool isOptiZoomEnabled();
761 
762     int32_t commitAFBracket(cam_af_bracketing_t afBracket);
763     int32_t set3ALock(bool lock3A);
764     int32_t setAndCommitZoom(int zoom_level);
765     uint8_t getBurstCountForAdvancedCapture();
766     uint32_t getNumberInBufsForSingleShot();
767     uint32_t getNumberOutBufsForSingleShot();
768     int32_t setLongshotEnable(bool enable);
769     String8 dump();
isUbiRefocus()770     inline bool isUbiRefocus() {return m_bReFocusOn &&
771             (m_pCapability->refocus_af_bracketing_need.output_count > 1);};
getRefocusMaxMetaSize()772     inline uint32_t getRefocusMaxMetaSize() {
773             return m_pCapability->refocus_af_bracketing_need.meta_max_size;};
getRefocusOutputCount()774     inline uint8_t getRefocusOutputCount() {
775             return m_pCapability->refocus_af_bracketing_need.output_count;};
generateThumbFromMain()776     inline bool generateThumbFromMain() {return isUbiFocusEnabled() ||
777             isChromaFlashEnabled() || isOptiZoomEnabled() || isUbiRefocus()
778             || isHDREnabled() || isStillMoreEnabled() || isTruePortraitEnabled(); }
779     void updateCurrentFocusPosition(cam_focus_pos_info_t &cur_pos_info);
780     void updateAEInfo(cam_3a_params_t &ae_params);
isAdvCamFeaturesEnabled()781     bool isAdvCamFeaturesEnabled() {return isUbiFocusEnabled() ||
782             isChromaFlashEnabled() || m_bOptiZoomOn || isHDREnabled() ||
783             isAEBracketEnabled() || isStillMoreEnabled() || isUbiRefocus();}
784     int32_t setAecLock(const char *aecStr);
785     int32_t updateDebugLevel();
786     bool is4k2kVideoResolution();
787     bool isUBWCEnabled();
788 
789     int getBrightness();
790     int32_t updateOisValue(bool oisValue);
791     int32_t setIntEvent(cam_int_evt_params_t params);
getofflineRAW()792     bool getofflineRAW() {return mOfflineRAW;}
793     int32_t updatePpFeatureMask(cam_stream_type_t stream_type);
794     int32_t getStreamPpMask(cam_stream_type_t stream_type, cam_feature_mask_t &pp_mask);
getSharpness()795     int32_t getSharpness() {return m_nSharpness;};
getEffect()796     int32_t getEffect() {return mParmEffect;};
797     int32_t updateFlashMode(cam_flash_mode_t flash_mode);
798     int32_t configureAEBracketing(cam_capture_frame_config_t &frame_config);
799     int32_t configureHDRBracketing(cam_capture_frame_config_t &frame_config);
800     int32_t configFrameCapture(bool commitSettings);
801     int32_t resetFrameCapture(bool commitSettings);
getStillMoreSettings()802     cam_still_more_t getStillMoreSettings() {return m_stillmore_config;};
setStillMoreSettings(cam_still_more_t stillmore_config)803     void setStillMoreSettings(cam_still_more_t stillmore_config)
804             {m_stillmore_config = stillmore_config;};
getStillMoreCapability()805     cam_still_more_t getStillMoreCapability()
806             {return m_pCapability->stillmore_settings_need;};
getDynamicImgData()807     cam_dyn_img_data_t getDynamicImgData() { return m_DynamicImgData; }
setDynamicImgData(cam_dyn_img_data_t d)808     void setDynamicImgData(cam_dyn_img_data_t d) { m_DynamicImgData = d; }
809 
getParmZoomLevel()810     int32_t getParmZoomLevel(){return mParmZoomLevel;};
getReprocCount()811     int8_t  getReprocCount(){return mTotalPPCount;};
812     bool isMultiPassReprocessing();
getCurPPCount()813     int8_t  getCurPPCount(){return mCurPPCount;};
814     void    setReprocCount();
815     bool    isPostProcScaling();
816     bool    isLLNoiseEnabled();
setCurPPCount(int8_t count)817     void    setCurPPCount(int8_t count) {mCurPPCount = count;};
818     int32_t setToneMapMode(uint32_t value, bool initCommit);
819     void setTintless(bool enable);
820     uint8_t getLongshotStages();
getBufBatchCount()821     int8_t  getBufBatchCount() {return mBufBatchCnt;};
getVideoBatchSize()822     int8_t  getVideoBatchSize() {return mVideoBatchSize;};
823 
824     int32_t setManualCaptureMode(
825             QCameraManualCaptureModes value = CAM_MANUAL_CAPTURE_TYPE_OFF);
getManualCaptureMode()826     QCameraManualCaptureModes getManualCaptureMode()
827             {return m_ManualCaptureMode;};
getExposureTime()828     int64_t getExposureTime() {return m_expTime;};
829 
getCaptureFrameConfig()830     cam_capture_frame_config_t getCaptureFrameConfig()
831             { return m_captureFrameConfig; };
832     void setJpegRotation(int rotation);
getJpegRotation()833     uint32_t getJpegRotation() { return mJpegRotation;};
834 
setLowLightLevel(cam_low_light_mode_t value)835     void setLowLightLevel(cam_low_light_mode_t value)
836             { m_LowLightLevel = value; };
getLowLightLevel()837     cam_low_light_mode_t getLowLightLevel() {return m_LowLightLevel;};
getLowLightCapture()838     bool getLowLightCapture() { return m_LLCaptureEnabled; };
839 
840     /* Dual camera specific */
getDcrf()841     bool getDcrf() { return m_bDcrfEnabled; }
842     int32_t setRelatedCamSyncInfo(
843             cam_sync_related_sensors_event_info_t* info);
844     const cam_sync_related_sensors_event_info_t*
845             getRelatedCamSyncInfo(void);
846     int32_t setFrameSyncEnabled(bool enable);
847     bool isFrameSyncEnabled(void);
848     int32_t getRelatedCamCalibration(
849             cam_related_system_calibration_data_t* calib);
850     int32_t bundleRelatedCameras(bool sync, uint32_t sessionid);
851     uint8_t fdModeInVideo();
isOEMFeatEnabled()852     bool isOEMFeatEnabled() { return m_bOEMFeatEnabled; }
853 
854     int32_t setZslMode(bool value);
855     int32_t updateZSLModeValue(bool value);
856 
857     bool isReprocScaleEnabled();
858     bool isUnderReprocScaling();
859     int32_t getPicSizeFromAPK(int &width, int &height);
860 
861     int32_t checkFeatureConcurrency();
862     int32_t setInstantAEC(uint8_t enable, bool initCommit);
863 
864     int32_t getAnalysisInfo(
865         bool fdVideoEnabled,
866         bool hal3,
867         uint32_t featureMask,
868         cam_analysis_info_t *pAnalysisInfo);
869 private:
870     int32_t setPreviewSize(const QCameraParameters& );
871     int32_t setVideoSize(const QCameraParameters& );
872     int32_t setPictureSize(const QCameraParameters& );
873     int32_t setLiveSnapshotSize(const QCameraParameters& );
874     int32_t setPreviewFormat(const QCameraParameters& );
875     int32_t setPictureFormat(const QCameraParameters& );
876     int32_t setOrientation(const QCameraParameters& );
877     int32_t setJpegThumbnailSize(const QCameraParameters& );
878     int32_t setJpegQuality(const QCameraParameters& );
879     int32_t setPreviewFpsRange(const QCameraParameters& );
880     int32_t setPreviewFrameRate(const QCameraParameters& );
881     int32_t setAutoExposure(const QCameraParameters& );
882     int32_t setEffect(const QCameraParameters& );
883     int32_t setBrightness(const QCameraParameters& );
884     int32_t setFocusMode(const QCameraParameters& );
885     int32_t setFocusPosition(const QCameraParameters& );
886     int32_t setSharpness(const QCameraParameters& );
887     int32_t setSaturation(const QCameraParameters& );
888     int32_t setContrast(const QCameraParameters& );
889     int32_t setSkinToneEnhancement(const QCameraParameters& );
890     int32_t setSceneDetect(const QCameraParameters& );
891     int32_t setVideoHDR(const QCameraParameters& );
892     int32_t setVtEnable(const QCameraParameters& );
893     int32_t setZoom(const QCameraParameters& );
894     int32_t setISOValue(const QCameraParameters& );
895     int32_t setContinuousISO(const QCameraParameters& );
896     int32_t setExposureTime(const QCameraParameters& );
897     int32_t setRotation(const QCameraParameters& );
898     int32_t setVideoRotation(const QCameraParameters& );
899     int32_t setFlash(const QCameraParameters& );
900     int32_t setAecLock(const QCameraParameters& );
901     int32_t setAwbLock(const QCameraParameters& );
902     int32_t setMCEValue(const QCameraParameters& );
903     int32_t setDISValue(const QCameraParameters& params);
904     int32_t setLensShadeValue(const QCameraParameters& );
905     int32_t setExposureCompensation(const QCameraParameters& );
906     int32_t setWhiteBalance(const QCameraParameters& );
907     int32_t setManualWhiteBalance(const QCameraParameters& );
908     int32_t setAntibanding(const QCameraParameters& );
909     int32_t setFocusAreas(const QCameraParameters& );
910     int32_t setMeteringAreas(const QCameraParameters& );
911     int32_t setSceneMode(const QCameraParameters& );
912     int32_t setSelectableZoneAf(const QCameraParameters& );
913     int32_t setAEBracket(const QCameraParameters& );
914     int32_t setAFBracket(const QCameraParameters& );
915     int32_t setReFocus(const QCameraParameters& );
916     int32_t setChromaFlash(const QCameraParameters& );
917     int32_t setOptiZoom(const QCameraParameters& );
918     int32_t setHDRMode(const QCameraParameters& );
919     int32_t setHDRNeed1x(const QCameraParameters& );
920     int32_t setTruePortrait(const QCameraParameters& );
921     int32_t setSeeMore(const QCameraParameters& );
922     int32_t setStillMore(const QCameraParameters& );
923     int32_t setNoiseReductionMode(const QCameraParameters& );
924     int32_t setRedeyeReduction(const QCameraParameters& );
925     int32_t setGpsLocation(const QCameraParameters& );
926     int32_t setRecordingHint(const QCameraParameters& );
927     int32_t setNoDisplayMode(const QCameraParameters& );
928     int32_t setWaveletDenoise(const QCameraParameters& );
929     int32_t setTemporalDenoise(const QCameraParameters&);
930     int32_t setZslMode(const QCameraParameters& );
931     int32_t setZslAttributes(const QCameraParameters& );
932     int32_t setAutoHDR(const QCameraParameters& params);
933     int32_t setCameraMode(const QCameraParameters& );
934     int32_t setSceneSelectionMode(const QCameraParameters& params);
935     int32_t setFaceRecognition(const QCameraParameters& );
936     int32_t setFlip(const QCameraParameters& );
937     int32_t setRetroActiveBurstNum(const QCameraParameters& params);
938     int32_t setBurstLEDOnPeriod(const QCameraParameters& params);
939     int32_t setSnapshotFDReq(const QCameraParameters& );
940     int32_t setStatsDebugMask();
941     int32_t setPAAF();
942     int32_t setTintlessValue(const QCameraParameters& params);
943     int32_t setCDSMode(const QCameraParameters& params);
944     int32_t setInitialExposureIndex(const QCameraParameters& params);
945     int32_t setInstantCapture(const QCameraParameters& params);
946     int32_t setInstantAEC(const QCameraParameters& params);
947     int32_t setMobicat(const QCameraParameters& params);
948     int32_t setRdiMode(const QCameraParameters& );
949     int32_t setSecureMode(const QCameraParameters& );
950     int32_t setCacheVideoBuffers(const QCameraParameters& params);
951     int32_t setCustomParams(const QCameraParameters& params);
952     int32_t setAutoExposure(const char *autoExp);
953     int32_t setPreviewFpsRange(int min_fps,int max_fps,
954             int vid_min_fps,int vid_max_fps);
955     int32_t setEffect(const char *effect);
956     int32_t setBrightness(int brightness);
957     int32_t setFocusMode(const char *focusMode);
958     int32_t setFocusPosition(const char *typeStr, const char *posStr);
959     int32_t setSharpness(int sharpness);
960     int32_t setSaturation(int saturation);
961     int32_t setContrast(int contrast);
962     int32_t setSkinToneEnhancement(int sceFactor);
963     int32_t setSceneDetect(const char *scendDetect);
964     int32_t setVideoHDR(const char *videoHDR);
965     int32_t setSensorSnapshotHDR(const char *snapshotHDR);
966     int32_t setVtEnable(const char *vtEnable);
967     int32_t setZoom(int zoom_level);
968     int32_t setISOValue(const char *isoValue);
969     int32_t setContinuousISO(const char *isoValue);
970     int32_t setExposureTime(const char *expTimeStr);
971     int32_t setFlash(const char *flashStr);
972     int32_t setAwbLock(const char *awbStr);
973     int32_t setMCEValue(const char *mceStr);
974     int32_t setDISValue(const char *disStr);
975     int32_t setHighFrameRate(const int32_t hfrMode);
976     int32_t setLensShadeValue(const char *lensShadeStr);
977     int32_t setExposureCompensation(int expComp);
978     int32_t setWhiteBalance(const char *wbStr);
979     int32_t setWBManualCCT(const char *cctStr);
980     int32_t setManualWBGains(const char *gainStr);
981     int32_t setAntibanding(const char *antiBandingStr);
982     int32_t setFocusAreas(const char *focusAreasStr);
983     int32_t setMeteringAreas(const char *meteringAreasStr);
984     int32_t setSceneMode(const char *sceneModeStr);
985     int32_t setSelectableZoneAf(const char *selZoneAFStr);
986     int32_t setAEBracket(const char *aecBracketStr);
987     int32_t setAFBracket(const char *afBracketStr);
988     int32_t setReFocus(const char *reFocusStr);
989     int32_t setChromaFlash(const char *chromaFlashStr);
990     int32_t setOptiZoom(const char *optiZoomStr);
991     int32_t setHDRMode(const char *optiZoomStr);
992     int32_t setHDRNeed1x(const char *optiZoomStr);
993     int32_t setTruePortrait(const char *truePortraitStr);
994     int32_t setSeeMore(const char *SeeMoreStr);
995     int32_t setStillMore(const char *StillMoreStr);
996     int32_t setNoiseReductionMode(const char *noiseReductionModeStr);
997     int32_t setRedeyeReduction(const char *redeyeStr);
998     int32_t setWaveletDenoise(const char *wnrStr);
999     int32_t setFaceRecognition(const char *faceRecog, uint32_t maxFaces);
1000     int32_t setTintlessValue(const char *tintStr);
1001     bool UpdateHFRFrameRate(const QCameraParameters& params);
1002     int32_t setRdiMode(const char *str);
1003     int32_t setSecureMode(const char *str);
1004     int32_t setLongshotParam(const QCameraParameters& params);
1005     int32_t parseGains(const char *gainStr, double &r_gain,
1006             double &g_gain, double &b_gain);
1007     int32_t setCacheVideoBuffers(const char *cacheVideoBufStr);
1008     int32_t setCDSMode(int32_t cds_mode, bool initCommit);
1009     int32_t setEztune();
1010     void setLowLightCapture();
1011     int setRecordingHintValue(int32_t value); // set local copy of video hint and send to server
1012                                               // no change in parameters value
1013     int32_t updateFlash(bool commitSettings);
1014     int32_t setRawSize(cam_dimension_t &dim);
setMaxPicSize(cam_dimension_t & dim)1015     int32_t setMaxPicSize(cam_dimension_t &dim) { m_maxPicSize = dim; return NO_ERROR; };
1016     void setBufBatchCount(int8_t buf_cnt);
1017     void setVideoBatchSize();
1018     void setDcrf();
1019     int32_t setStreamPpMask(cam_stream_type_t stream_type, cam_feature_mask_t pp_mask);
1020     void setOfflineRAW(bool value = 0);
1021     int32_t configureFlash(cam_capture_frame_config_t &frame_config);
1022     int32_t configureLowLight(cam_capture_frame_config_t &frame_config);
1023     int32_t configureManualCapture(cam_capture_frame_config_t &frame_config);
1024 
isTNRPreviewEnabled()1025     bool isTNRPreviewEnabled() {return m_bTNRPreviewOn;};
isTNRVideoEnabled()1026     bool isTNRVideoEnabled() {return m_bTNRVideoOn;};
getFaceDetectionOption()1027     bool getFaceDetectionOption() { return  m_bFaceDetectionOn;}
1028     bool isAVTimerEnabled();
1029     void getLiveSnapshotSize(cam_dimension_t &dim);
getRawSize(cam_dimension_t & dim)1030     int32_t getRawSize(cam_dimension_t &dim) {dim = m_rawSize; return NO_ERROR;};
1031     int getAutoFlickerMode();
1032     bool sendStreamConfigInfo(cam_stream_size_info_t &stream_config_info);
isLowMemoryDevice()1033     inline bool isLowMemoryDevice() {return m_bIsLowMemoryDevice;};
1034     bool isPreviewSeeMoreRequired();
isEztuneEnabled()1035     bool isEztuneEnabled() { return m_bEztuneEnabled; };
getZoomLevel()1036     int32_t getZoomLevel(){return mZoomLevel;};
1037     int32_t parse_pair(const char *str, int *first, int *second,
1038                        char delim, char **endptr);
1039     void parseSizesList(const char *sizesStr, Vector<Size> &sizes);
1040     int32_t parseNDimVector(const char *str, int *num, int N, char delim);
1041     int32_t parseCameraAreaString(const char *str, int max_num_areas,
1042                                   cam_area_t *pAreas, int& num_areas_found);
1043     bool validateCameraAreas(cam_area_t *areas, int num_areas);
1044     int parseGPSCoordinate(const char *coord_str, rat_t *coord);
1045     int32_t getRational(rat_t *rat, int num, int denom);
1046     String8 createSizesString(const cam_dimension_t *sizes, size_t len);
1047     String8 createHfrValuesString(const cam_hfr_info_t *values, size_t len,
1048             const QCameraMap<cam_hfr_mode_t> *map, size_t map_len);
1049     String8 createHfrSizesString(const cam_hfr_info_t *values, size_t len);
1050     String8 createFpsRangeString(const cam_fps_range_t *fps,
1051             size_t len, int &default_fps_index);
1052     String8 createFpsString(cam_fps_range_t &fps);
1053     String8 createZoomRatioValuesString(uint32_t *zoomRatios, size_t length);
1054     int32_t setDualLedCalibration(const QCameraParameters& params);
1055     int32_t setAdvancedCaptureMode();
1056 
1057     // ops for batch set/get params with server
1058     int32_t initBatchUpdate(parm_buffer_t *p_table);
1059     int32_t commitSetBatch();
1060     int32_t commitGetBatch();
1061 
1062     // ops to tempororily update parameter entries and commit
1063     int32_t updateParamEntry(const char *key, const char *value);
1064     int32_t commitParamChanges();
1065     void updateViewAngles();
1066 
1067     // Map from strings to values
1068     static const cam_dimension_t THUMBNAIL_SIZES_MAP[];
1069     static const QCameraMap<cam_auto_exposure_mode_type> AUTO_EXPOSURE_MAP[];
1070     static const QCameraMap<cam_aec_convergence_type> INSTANT_CAPTURE_MODES_MAP[];
1071     static const QCameraMap<cam_aec_convergence_type> INSTANT_AEC_MODES_MAP[];
1072     static const QCameraMap<cam_format_t> PREVIEW_FORMATS_MAP[];
1073     static const QCameraMap<cam_format_t> PICTURE_TYPES_MAP[];
1074     static const QCameraMap<cam_focus_mode_type> FOCUS_MODES_MAP[];
1075     static const QCameraMap<cam_effect_mode_type> EFFECT_MODES_MAP[];
1076     static const QCameraMap<cam_scene_mode_type> SCENE_MODES_MAP[];
1077     static const QCameraMap<cam_flash_mode_t> FLASH_MODES_MAP[];
1078     static const QCameraMap<cam_focus_algorithm_type> FOCUS_ALGO_MAP[];
1079     static const QCameraMap<cam_wb_mode_type> WHITE_BALANCE_MODES_MAP[];
1080     static const QCameraMap<cam_antibanding_mode_type> ANTIBANDING_MODES_MAP[];
1081     static const QCameraMap<cam_iso_mode_type> ISO_MODES_MAP[];
1082     static const QCameraMap<cam_hfr_mode_t> HFR_MODES_MAP[];
1083     static const QCameraMap<cam_bracket_mode> BRACKETING_MODES_MAP[];
1084     static const QCameraMap<int> ON_OFF_MODES_MAP[];
1085     static const QCameraMap<int> ENABLE_DISABLE_MODES_MAP[];
1086     static const QCameraMap<int> DENOISE_ON_OFF_MODES_MAP[];
1087     static const QCameraMap<int> TRUE_FALSE_MODES_MAP[];
1088     static const QCameraMap<int> TOUCH_AF_AEC_MODES_MAP[];
1089     static const QCameraMap<cam_flip_t> FLIP_MODES_MAP[];
1090     static const QCameraMap<int> AF_BRACKETING_MODES_MAP[];
1091     static const QCameraMap<int> RE_FOCUS_MODES_MAP[];
1092     static const QCameraMap<int> CHROMA_FLASH_MODES_MAP[];
1093     static const QCameraMap<int> OPTI_ZOOM_MODES_MAP[];
1094     static const QCameraMap<int> TRUE_PORTRAIT_MODES_MAP[];
1095     static const QCameraMap<cam_cds_mode_type_t> CDS_MODES_MAP[];
1096     static const QCameraMap<int> HDR_MODES_MAP[];
1097     static const QCameraMap<int> VIDEO_ROTATION_MODES_MAP[];
1098     static const QCameraMap<int> SEE_MORE_MODES_MAP[];
1099     static const QCameraMap<int> STILL_MORE_MODES_MAP[];
1100     static const QCameraMap<int> NOISE_REDUCTION_MODES_MAP[];
1101 
1102     QCameraReprocScaleParam m_reprocScaleParam;
1103     QCameraCommon           mCommon;
1104 
1105     cam_capability_t *m_pCapability;
1106     mm_camera_vtbl_t *m_pCamOpsTbl;
1107     QCameraHeapMemory *m_pParamHeap;
1108     parm_buffer_t     *m_pParamBuf;  // ptr to param buf in m_pParamHeap
1109     /* heap for mapping dual cam event info */
1110     QCameraHeapMemory *m_pRelCamSyncHeap;
1111     /* ptr to sync buffer in m_pRelCamSyncHeap */
1112     cam_sync_related_sensors_event_info_t *m_pRelCamSyncBuf;
1113     cam_sync_related_sensors_event_info_t m_relCamSyncInfo;
1114     bool m_bFrameSyncEnabled;
1115     cam_is_type_t mIsType;
1116 
1117     bool m_bZslMode;                // if ZSL is enabled
1118     bool m_bZslMode_new;
1119     bool m_bForceZslMode;
1120     bool m_bRecordingHint;          // local copy of recording hint
1121     bool m_bRecordingHint_new;
1122     bool m_bHistogramEnabled;       // if histogram is enabled
1123     bool m_bLongshotEnabled;       // if longshot is enabled
1124     uint32_t m_nFaceProcMask;       // face process mask
1125     bool m_bFaceDetectionOn;        //  if face Detection turned on by user
1126     bool m_bDebugFps;               // if FPS need to be logged
1127     cam_focus_mode_type mFocusMode;
1128     cam_format_t mPreviewFormat;
1129     cam_format_t mAppPreviewFormat;
1130     int32_t mPictureFormat;         // could be CAMERA_PICTURE_TYPE_JPEG or cam_format_t
1131     bool m_bNeedRestart;            // if preview needs restart after parameters updated
1132     bool m_bNoDisplayMode;
1133     bool m_bWNROn;
1134     bool m_bTNRPreviewOn;
1135     bool m_bTNRVideoOn;
1136     bool m_bTNRSnapshotOn;
1137     bool m_bInited;
1138     int m_nRetroBurstNum;
1139     int m_nBurstLEDOnPeriod;
1140     cam_exp_bracketing_t m_AEBracketingClient;
1141     bool m_bUpdateEffects;          // Cause reapplying of effects
1142     bool m_bSceneTransitionAuto;    // Indicate that scene has changed to Auto
1143     bool m_bPreviewFlipChanged;        // if flip setting for preview changed
1144     bool m_bVideoFlipChanged;          // if flip setting for video changed
1145     bool m_bSnapshotFlipChanged;       // if flip setting for snapshot changed
1146     bool m_bFixedFrameRateSet;      // Indicates that a fixed frame rate is set
1147     qcamera_thermal_mode m_ThermalMode; // adjust fps vs adjust frameskip
1148     cam_dimension_t m_LiveSnapshotSize; // live snapshot size
1149     cam_dimension_t m_rawSize; // live snapshot size
1150     cam_dimension_t m_maxPicSize;
1151     bool m_bHDREnabled;             // if HDR is enabled
1152     bool m_bLocalHDREnabled;   // This flag tells whether HDR enabled or not regarless of APP mode
1153     bool m_bAVTimerEnabled;    //if AVTimer is enabled
1154     bool m_bDISEnabled;
1155     bool m_bOISEnabled;
1156     cam_still_more_t m_stillmore_config;
1157 
1158     uint8_t m_MobiMask;
1159     QCameraAdjustFPS *m_AdjustFPS;
1160     bool m_bHDR1xFrameEnabled;          // if frame with exposure compensation 0 during HDR is enabled
1161     bool m_HDRSceneEnabled; // Auto HDR indication
1162     bool m_bHDRThumbnailProcessNeeded;        // if thumbnail need to be processed for HDR
1163     bool m_bHDR1xExtraBufferNeeded;     // if extra frame with exposure compensation 0 during HDR is needed
1164     bool m_bHDROutputCropEnabled;     // if HDR output frame need to be scaled to user resolution
1165     DefaultKeyedVector<String8,String8> m_tempMap; // map for temororily store parameters to be set
1166     cam_fps_range_t m_default_fps_range;
1167     bool m_bAFBracketingOn;
1168     bool m_bReFocusOn;
1169     bool m_bChromaFlashOn;
1170     bool m_bOptiZoomOn;
1171     bool m_bSceneSelection;
1172     Mutex m_SceneSelectLock;
1173     cam_scene_mode_type m_SelectedScene;
1174     bool m_bSeeMoreOn;
1175     bool m_bStillMoreOn;
1176     bool m_bHighQualityNoiseReductionMode;
1177     cam_fps_range_t m_hfrFpsRange;
1178     bool m_bHfrMode;
1179     bool m_bSensorHDREnabled;             // if HDR is enabled
1180     bool m_bRdiMode;                // if RDI mode
1181     bool m_bSecureMode;
1182     bool m_bAeBracketingEnabled;
1183     int32_t mFlashValue;
1184     int32_t mFlashDaemonValue;
1185     int32_t mHfrMode;
1186     bool m_bHDRModeSensor;
1187     bool mOfflineRAW;
1188     bool m_bTruePortraitOn;
1189     cam_feature_mask_t m_nMinRequiredPpMask;
1190     cam_feature_mask_t mStreamPpMask[CAM_STREAM_TYPE_MAX];
1191     int32_t m_nSharpness;
1192     int8_t mTotalPPCount;
1193     int8_t mCurPPCount;
1194     int32_t mZoomLevel;
1195     int32_t mParmZoomLevel;
1196     bool m_bIsLowMemoryDevice;
1197     int32_t mCds_mode;
1198     int32_t mParmEffect;
1199     cam_capture_frame_config_t m_captureFrameConfig;
1200     int8_t mBufBatchCnt;
1201     bool m_bEztuneEnabled;
1202     bool m_bDcrfEnabled;
1203     uint32_t mRotation;
1204     uint32_t mJpegRotation;
1205     int8_t mVideoBatchSize;
1206     bool m_LLCaptureEnabled;
1207     cam_low_light_mode_t m_LowLightLevel;
1208     bool m_bLtmForSeeMoreEnabled;
1209     int64_t m_expTime;
1210     bool m_bOEMFeatEnabled;
1211     int32_t m_isoValue;
1212     QCameraManualCaptureModes m_ManualCaptureMode;
1213     cam_dyn_img_data_t m_DynamicImgData;
1214     int32_t m_dualLedCalibration;
1215     // Param to trigger instant AEC.
1216     bool m_bInstantAEC;
1217     // Param to trigger instant capture.
1218     bool m_bInstantCapture;
1219     // Number of frames, camera interface will wait for getting the instant capture frame.
1220     uint8_t mAecFrameBound;
1221     // Number of preview frames, that HAL will hold without displaying, for instant AEC mode.
1222     uint8_t mAecSkipDisplayFrameBound;
1223 };
1224 
1225 }; // namespace qcamera
1226 
1227 #endif
1228