Home | History | Annotate | Download | only in HAL
      1 /*
      2 **
      3 ** Copyright 2008, The Android Open Source Project
      4 ** Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
      5 ** Not a Contribution. Apache license notifications and license are
      6 ** retained for attribution purposes only.
      7 **
      8 ** Licensed under the Apache License, Version 2.0 (the "License");
      9 ** you may not use this file except in compliance with the License.
     10 ** You may obtain a copy of the License at
     11 **
     12 **     http://www.apache.org/licenses/LICENSE-2.0
     13 **
     14 ** Unless required by applicable law or agreed to in writing, software
     15 ** distributed under the License is distributed on an "AS IS" BASIS,
     16 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     17 ** See the License for the specific language governing permissions and
     18 ** limitations under the License.
     19 */
     20 #ifndef ANDROID_HARDWARE_QCAMERA_PARAMETERS_H
     21 #define ANDROID_HARDWARE_QCAMERA_PARAMETERS_H
     22 
     23 #include <camera/CameraParameters.h>
     24 #include <cutils/properties.h>
     25 #include <hardware/camera.h>
     26 #include <stdlib.h>
     27 #include <utils/Errors.h>
     28 #include "cam_intf.h"
     29 #include "QCameraMem.h"
     30 #include "QCameraThermalAdapter.h"
     31 
     32 extern "C" {
     33 #include <mm_jpeg_interface.h>
     34 }
     35 
     36 using namespace android;
     37 
     38 namespace qcamera {
     39 
     40 //EXIF globals
     41 static const char ExifAsciiPrefix[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 };          // "ASCII\0\0\0"
     42 static const char ExifUndefinedPrefix[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };   // "\0\0\0\0\0\0\0\0"
     43 
     44 #define EXIF_ASCII_PREFIX_SIZE           8   //(sizeof(ExifAsciiPrefix))
     45 #define FOCAL_LENGTH_DECIMAL_PRECISION   100
     46 
     47 class QCameraParameters: public CameraParameters
     48 {
     49 public:
     50     QCameraParameters();
     51     QCameraParameters(const String8 &params);
     52     ~QCameraParameters();
     53 
     54     // Supported PREVIEW/RECORDING SIZES IN HIGH FRAME RATE recording, sizes in pixels.
     55     // Example value: "800x480,432x320". Read only.
     56     static const char KEY_QC_SUPPORTED_HFR_SIZES[];
     57     // The mode of preview frame rate.
     58     // Example value: "frame-rate-auto, frame-rate-fixed".
     59     static const char KEY_QC_PREVIEW_FRAME_RATE_MODE[];
     60     static const char KEY_QC_SUPPORTED_PREVIEW_FRAME_RATE_MODES[];
     61     static const char KEY_QC_PREVIEW_FRAME_RATE_AUTO_MODE[];
     62     static const char KEY_QC_PREVIEW_FRAME_RATE_FIXED_MODE[];
     63     static const char KEY_QC_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] ;
     64 
     65     // Supported live snapshot sizes
     66     static const char KEY_QC_SUPPORTED_LIVESNAPSHOT_SIZES[];
     67 
     68     // Supported Raw formats
     69     static const char KEY_QC_SUPPORTED_RAW_FORMATS[];
     70     static const char KEY_QC_RAW_FORMAT[];
     71 
     72     //Touch Af/AEC settings.
     73     static const char KEY_QC_TOUCH_AF_AEC[];
     74     static const char KEY_QC_SUPPORTED_TOUCH_AF_AEC[];
     75     //Touch Index for AEC.
     76     static const char KEY_QC_TOUCH_INDEX_AEC[];
     77     //Touch Index for AF.
     78     static const char KEY_QC_TOUCH_INDEX_AF[];
     79     // Current auto scene detection mode.
     80     // Example value: "off" or "on" constants. Read/write.
     81     static const char KEY_QC_SCENE_DETECT[];
     82     // Supported auto scene detection settings.
     83     // Example value: "off,on". Read only.
     84     static const char KEY_QC_SUPPORTED_SCENE_DETECT[];
     85     static const char KEY_QC_SELECTABLE_ZONE_AF[];
     86 
     87     static const char KEY_QC_ISO_MODE[];
     88     static const char KEY_QC_SUPPORTED_ISO_MODES[];
     89     static const char KEY_QC_LENSSHADE[] ;
     90     static const char KEY_QC_SUPPORTED_LENSSHADE_MODES[] ;
     91     static const char KEY_QC_AUTO_EXPOSURE[];
     92     static const char KEY_QC_SUPPORTED_AUTO_EXPOSURE[];
     93 
     94     static const char KEY_QC_GPS_LATITUDE_REF[];
     95     static const char KEY_QC_GPS_LONGITUDE_REF[];
     96     static const char KEY_QC_GPS_ALTITUDE_REF[];
     97     static const char KEY_QC_GPS_STATUS[];
     98     static const char KEY_QC_MEMORY_COLOR_ENHANCEMENT[];
     99     static const char KEY_QC_SUPPORTED_MEM_COLOR_ENHANCE_MODES[];
    100     static const char KEY_QC_DIS[];
    101     static const char KEY_QC_SUPPORTED_DIS_MODES[];
    102 
    103     static const char KEY_QC_ZSL[];
    104     static const char KEY_QC_SUPPORTED_ZSL_MODES[];
    105     static const char KEY_QC_ZSL_BURST_INTERVAL[];
    106     static const char KEY_QC_ZSL_BURST_LOOKBACK[];
    107     static const char KEY_QC_ZSL_QUEUE_DEPTH[];
    108 
    109     static const char KEY_QC_CAMERA_MODE[];
    110     static const char KEY_QC_ORIENTATION[];
    111 
    112     static const char KEY_QC_VIDEO_HIGH_FRAME_RATE[];
    113     static const char KEY_QC_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[];
    114     static const char KEY_QC_HIGH_DYNAMIC_RANGE_IMAGING[];
    115     static const char KEY_QC_SUPPORTED_HDR_IMAGING_MODES[];
    116     static const char KEY_QC_AE_BRACKET_HDR[];
    117     static const char KEY_QC_SUPPORTED_AE_BRACKET_MODES[];
    118     static const char KEY_QC_CAPTURE_BURST_EXPOSURE[];
    119     static const char KEY_QC_NUM_SNAPSHOT_PER_SHUTTER[];
    120     static const char KEY_QC_NO_DISPLAY_MODE[];
    121     static const char KEY_QC_RAW_PICUTRE_SIZE[];
    122 
    123     // DENOISE
    124     static const char KEY_QC_DENOISE[];
    125     static const char KEY_QC_SUPPORTED_DENOISE[];
    126 
    127     //Selectable zone AF.
    128     static const char KEY_QC_FOCUS_ALGO[];
    129     static const char KEY_QC_SUPPORTED_FOCUS_ALGOS[];
    130 
    131     //Face Detection
    132     static const char KEY_QC_FACE_DETECTION[];
    133     static const char KEY_QC_SUPPORTED_FACE_DETECTION[];
    134 
    135     //Face Recognition
    136     static const char KEY_QC_FACE_RECOGNITION[];
    137     static const char KEY_QC_SUPPORTED_FACE_RECOGNITION[];
    138 
    139     // supported camera features to be queried by Snapdragon SDK
    140     //Read only
    141     static const char KEY_QC_SUPPORTED_CAMERA_FEATURES[];
    142 
    143     //Indicates number of faces requested by the application.
    144     //This value will be rejected if the requested faces
    145     //greater than supported by hardware.
    146     //Write only.
    147     static const char KEY_QC_MAX_NUM_REQUESTED_FACES[];
    148 
    149     //preview flip
    150     static const char KEY_QC_PREVIEW_FLIP[];
    151     //video flip
    152     static const char KEY_QC_VIDEO_FLIP[];
    153     //snapshot picture flip
    154     static const char KEY_QC_SNAPSHOT_PICTURE_FLIP[];
    155 
    156     static const char KEY_QC_SUPPORTED_FLIP_MODES[];
    157 
    158     //Redeye Reduction
    159     static const char KEY_QC_REDEYE_REDUCTION[];
    160     static const char KEY_QC_SUPPORTED_REDEYE_REDUCTION[];
    161     static const char EFFECT_EMBOSS[];
    162     static const char EFFECT_SKETCH[];
    163     static const char EFFECT_NEON[];
    164 
    165     // Values for Touch AF/AEC
    166     static const char TOUCH_AF_AEC_OFF[];
    167     static const char TOUCH_AF_AEC_ON[];
    168 
    169     // Values for Scene mode
    170     static const char SCENE_MODE_ASD[];
    171     static const char SCENE_MODE_BACKLIGHT[];
    172     static const char SCENE_MODE_FLOWERS[];
    173     static const char SCENE_MODE_AR[];
    174     static const char SCENE_MODE_HDR[];
    175     static const char PIXEL_FORMAT_YUV420SP_ADRENO[]; // ADRENO
    176     static const char PIXEL_FORMAT_YV12[]; // NV12
    177     static const char PIXEL_FORMAT_NV12[]; //NV12
    178 
    179     // Values for raw picture format
    180     static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_YUYV[];
    181     static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_YVYU[];
    182     static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_UYVY[];
    183     static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_VYUY[];
    184     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GBRG[];
    185     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GRBG[];
    186     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8RGGB[];
    187     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8BGGR[];
    188     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GBRG[];
    189     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GRBG[];
    190     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10RGGB[];
    191     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10BGGR[];
    192     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GBRG[];
    193     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GRBG[];
    194     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12RGGB[];
    195     static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12BGGR[];
    196     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GBRG[];
    197     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GRBG[];
    198     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8RGGB[];
    199     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8BGGR[];
    200     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GBRG[];
    201     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GRBG[];
    202     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10RGGB[];
    203     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10BGGR[];
    204     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GBRG[];
    205     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GRBG[];
    206     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12RGGB[];
    207     static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12BGGR[];
    208     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GBRG[];
    209     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GRBG[];
    210     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8RGGB[];
    211     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8BGGR[];
    212     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GBRG[];
    213     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GRBG[];
    214     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10RGGB[];
    215     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10BGGR[];
    216     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GBRG[];
    217     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GRBG[];
    218     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12RGGB[];
    219     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12BGGR[];
    220     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GBRG[];
    221     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GRBG[];
    222     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8RGGB[];
    223     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8BGGR[];
    224     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GBRG[];
    225     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GRBG[];
    226     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10RGGB[];
    227     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10BGGR[];
    228     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GBRG[];
    229     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GRBG[];
    230     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12RGGB[];
    231     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12BGGR[];
    232     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GBRG[];
    233     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GRBG[];
    234     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8RGGB[];
    235     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8BGGR[];
    236     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GBRG[];
    237     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GRBG[];
    238     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8RGGB[];
    239     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8BGGR[];
    240     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GBRG[];
    241     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GRBG[];
    242     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10RGGB[];
    243     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10BGGR[];
    244     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GBRG[];
    245     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GRBG[];
    246     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12RGGB[];
    247     static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12BGGR[];
    248 
    249     // ISO values
    250     static const char ISO_AUTO[];
    251     static const char ISO_HJR[];
    252     static const char ISO_100[];
    253     static const char ISO_200[];
    254     static const char ISO_400[];
    255     static const char ISO_800[];
    256     static const char ISO_1600[];
    257 
    258     // Values for auto exposure settings.
    259     static const char AUTO_EXPOSURE_FRAME_AVG[];
    260     static const char AUTO_EXPOSURE_CENTER_WEIGHTED[];
    261     static const char AUTO_EXPOSURE_SPOT_METERING[];
    262     static const char AUTO_EXPOSURE_SMART_METERING[];
    263     static const char AUTO_EXPOSURE_USER_METERING[];
    264     static const char AUTO_EXPOSURE_SPOT_METERING_ADV[];
    265     static const char AUTO_EXPOSURE_CENTER_WEIGHTED_ADV[];
    266 
    267     static const char KEY_QC_SHARPNESS[];
    268     static const char KEY_QC_MIN_SHARPNESS[];
    269     static const char KEY_QC_MAX_SHARPNESS[];
    270     static const char KEY_QC_SHARPNESS_STEP[];
    271     static const char KEY_QC_CONTRAST[];
    272     static const char KEY_QC_MIN_CONTRAST[];
    273     static const char KEY_QC_MAX_CONTRAST[];
    274     static const char KEY_QC_CONTRAST_STEP[];
    275     static const char KEY_QC_SATURATION[];
    276     static const char KEY_QC_MIN_SATURATION[];
    277     static const char KEY_QC_MAX_SATURATION[];
    278     static const char KEY_QC_SATURATION_STEP[];
    279     static const char KEY_QC_BRIGHTNESS[];
    280     static const char KEY_QC_MIN_BRIGHTNESS[];
    281     static const char KEY_QC_MAX_BRIGHTNESS[];
    282     static const char KEY_QC_BRIGHTNESS_STEP[];
    283     static const char KEY_QC_SCE_FACTOR[];
    284     static const char KEY_QC_MIN_SCE_FACTOR[];
    285     static const char KEY_QC_MAX_SCE_FACTOR[];
    286     static const char KEY_QC_SCE_FACTOR_STEP[];
    287 
    288     static const char KEY_QC_HISTOGRAM[] ;
    289     static const char KEY_QC_SUPPORTED_HISTOGRAM_MODES[] ;
    290     static const char KEY_QC_HDR_NEED_1X[];
    291     static const char KEY_QC_VIDEO_HDR[];
    292     static const char KEY_QC_SUPPORTED_VIDEO_HDR_MODES[];
    293 
    294     // Values for SKIN TONE ENHANCEMENT
    295     static const char SKIN_TONE_ENHANCEMENT_ENABLE[] ;
    296     static const char SKIN_TONE_ENHANCEMENT_DISABLE[] ;
    297 
    298     // Values for Denoise
    299     static const char DENOISE_OFF[] ;
    300     static const char DENOISE_ON[] ;
    301 
    302     // Values for auto exposure settings.
    303     static const char FOCUS_ALGO_AUTO[];
    304     static const char FOCUS_ALGO_SPOT_METERING[];
    305     static const char FOCUS_ALGO_CENTER_WEIGHTED[];
    306     static const char FOCUS_ALGO_FRAME_AVERAGE[];
    307 
    308     // Values for AE Bracketing settings.
    309     static const char AE_BRACKET_OFF[];
    310     static const char AE_BRACKET[];
    311 
    312     // Values for HFR settings.
    313     static const char VIDEO_HFR_OFF[];
    314     static const char VIDEO_HFR_2X[];
    315     static const char VIDEO_HFR_3X[];
    316     static const char VIDEO_HFR_4X[];
    317     static const char VIDEO_HFR_5X[];
    318 
    319     // Values for feature on/off settings.
    320     static const char VALUE_OFF[];
    321     static const char VALUE_ON[];
    322 
    323     // Values for feature enable/disable settings.
    324     static const char VALUE_ENABLE[];
    325     static const char VALUE_DISABLE[];
    326 
    327     // Values for feature true/false settings.
    328     static const char VALUE_FALSE[];
    329     static const char VALUE_TRUE[];
    330 
    331     //Values for flip settings
    332     static const char FLIP_MODE_OFF[];
    333     static const char FLIP_MODE_V[];
    334     static const char FLIP_MODE_H[];
    335     static const char FLIP_MODE_VH[];
    336 
    337     enum {
    338         CAMERA_ORIENTATION_UNKNOWN = 0,
    339         CAMERA_ORIENTATION_PORTRAIT = 1,
    340         CAMERA_ORIENTATION_LANDSCAPE = 2,
    341     };
    342     typedef struct {
    343         const char *const desc;
    344         int val;
    345     } QCameraMap;
    346 
    347     void getSupportedHfrSizes(Vector<Size> &sizes);
    348     void setPreviewFrameRateMode(const char *mode);
    349     const char *getPreviewFrameRateMode() const;
    350     void setTouchIndexAec(int x, int y);
    351     void getTouchIndexAec(int *x, int *y);
    352     void setTouchIndexAf(int x, int y);
    353     void getTouchIndexAf(int *x, int *y);
    354 
    355     int32_t init(cam_capability_t *, mm_camera_vtbl_t *);
    356     void deinit();
    357     int32_t assign(QCameraParameters& params);
    358     int32_t initDefaultParameters();
    359     int32_t updateParameters(QCameraParameters&, bool &needRestart);
    360     int32_t commitParameters();
    361     int getPreviewHalPixelFormat() const;
    362     int32_t getStreamFormat(cam_stream_type_t streamType,
    363                              cam_format_t &format);
    364     int32_t getStreamDimension(cam_stream_type_t streamType,
    365                                 cam_dimension_t &dim);
    366     void getThumbnailSize(int *width, int *height) const;
    367 
    368     int getZSLBurstInterval();
    369     int getZSLQueueDepth();
    370     int getZSLBackLookCount();
    371     int getMaxUnmatchedFramesInQueue();
    372     bool isZSLMode() {return m_bZslMode;};
    373     bool isNoDisplayMode() {return m_bNoDisplayMode;};
    374     bool isWNREnabled() {return m_bWNROn;};
    375     uint8_t getNumOfSnapshots();
    376     uint8_t getNumOfExtraHDRBufsIfNeeded();
    377     uint8_t getNumOfHDRBufsIfNeeded();
    378     int getBurstNum();
    379     bool getRecordingHintValue() {return m_bRecordingHint;}; // return local copy of video hint
    380     int setRecordingHintValue(int32_t value); // set local copy of video hint and send to server
    381                                               // no change in parameters value
    382     int getJpegQuality();
    383     int getJpegRotation();
    384 
    385     int32_t getExifDateTime(char *dateTime, uint32_t &count);
    386     int32_t getExifFocalLength(rat_t *focalLenght);
    387     uint16_t getExifIsoSpeed();
    388     int32_t getExifGpsProcessingMethod(char *gpsProcessingMethod, uint32_t &count);
    389     int32_t getExifLatitude(rat_t *latitude, char *latRef);
    390     int32_t getExifLongitude(rat_t *longitude, char *lonRef);
    391     int32_t getExifAltitude(rat_t *altitude, char *altRef);
    392     int32_t getExifGpsDateTimeStamp(char *gpsDateStamp, uint32_t bufLen, rat_t *gpsTimeStamp);
    393     int32_t updateFocusDistances(cam_focus_distances_info_t *focusDistances);
    394 
    395     bool isFpsDebugEnabled() {return m_bDebugFps;};
    396     bool isHistogramEnabled() {return m_bHistogramEnabled;};
    397     bool isFaceDetectionEnabled() {return ((m_nFaceProcMask & CAM_FACE_PROCESS_MASK_DETECTION) != 0);};
    398     int32_t setHistogram(bool enabled);
    399     int32_t setFaceDetection(bool enabled);
    400     int32_t setLockCAF(bool bLock);
    401     int32_t setFrameSkip(enum msm_vfe_frame_skip_pattern pattern);
    402     qcamera_thermal_mode getThermalMode() {return m_ThermalMode;};
    403     int32_t updateRecordingHintValue(int32_t value);
    404 
    405     cam_focus_mode_type getFocusMode() const {return mFocusMode;};
    406     int32_t setNumOfSnapshot();
    407     int32_t adjustPreviewFpsRange(cam_fps_range_t *fpsRange);
    408     bool isJpegPictureFormat() {return (mPictureFormat == CAM_FORMAT_JPEG);};
    409     bool isNV16PictureFormat() {return (mPictureFormat == CAM_FORMAT_YUV_422_NV16);};
    410     cam_denoise_process_type_t getWaveletDenoiseProcessPlate();
    411     int32_t getLiveSnapshotSize(cam_dimension_t &dim) {dim = m_LiveSnapshotSize; return NO_ERROR;};
    412     int getFlipMode(cam_stream_type_t streamType);
    413 
    414     void setLockCAFNeeded(bool bNeedflag) {m_bNeedLockCAF = bNeedflag;};
    415     bool isLockCAFNeeded() {return m_bNeedLockCAF;};
    416     bool isCAFLocked() {return m_bCAFLocked;};
    417     void setAFRunning(bool bflag) {m_bAFRunning = bflag;};
    418     bool isAFRunning() {return m_bAFRunning;};
    419 
    420 private:
    421     int32_t setPreviewSize(const QCameraParameters& );
    422     int32_t setVideoSize(const QCameraParameters& );
    423     int32_t setPictureSize(const QCameraParameters& );
    424     int32_t setLiveSnapshotSize(const QCameraParameters& );
    425     int32_t setPreviewFormat(const QCameraParameters& );
    426     int32_t setPictureFormat(const QCameraParameters& );
    427     int32_t setOrientation(const QCameraParameters& );
    428     int32_t setJpegThumbnailSize(const QCameraParameters& );
    429     int32_t setJpegQuality(const QCameraParameters& );
    430     int32_t setPreviewFpsRange(const QCameraParameters& );
    431     int32_t setPreviewFrameRate(const QCameraParameters& );
    432     int32_t setAutoExposure(const QCameraParameters& );
    433     int32_t setEffect(const QCameraParameters& );
    434     int32_t setBrightness(const QCameraParameters& );
    435     int32_t setFocusMode(const QCameraParameters& );
    436     int32_t setSharpness(const QCameraParameters& );
    437     int32_t setSaturation(const QCameraParameters& );
    438     int32_t setContrast(const QCameraParameters& );
    439     int32_t setSkinToneEnhancement(const QCameraParameters& );
    440     int32_t setSceneDetect(const QCameraParameters& );
    441     int32_t setVideoHDR(const QCameraParameters& );
    442     int32_t setZoom(const QCameraParameters& );
    443     int32_t setISOValue(const QCameraParameters& );
    444     int32_t setRotation(const QCameraParameters& );
    445     int32_t setFlash(const QCameraParameters& );
    446     int32_t setAecLock(const QCameraParameters& );
    447     int32_t setAwbLock(const QCameraParameters& );
    448     int32_t setMCEValue(const QCameraParameters& );
    449     int32_t setDISValue(const QCameraParameters& params);
    450     int32_t setHighFrameRate(const QCameraParameters& );
    451     int32_t setLensShadeValue(const QCameraParameters& );
    452     int32_t setExposureCompensation(const QCameraParameters& );
    453     int32_t setWhiteBalance(const QCameraParameters& );
    454     int32_t setAntibanding(const QCameraParameters& );
    455     int32_t setFocusAreas(const QCameraParameters& );
    456     int32_t setMeteringAreas(const QCameraParameters& );
    457     int32_t setSceneMode(const QCameraParameters& );
    458     int32_t setSelectableZoneAf(const QCameraParameters& );
    459     int32_t setAEBracket(const QCameraParameters& );
    460     int32_t setRedeyeReduction(const QCameraParameters& );
    461     int32_t setGpsLocation(const QCameraParameters& );
    462     int32_t setRecordingHint(const QCameraParameters& );
    463     int32_t setNoDisplayMode(const QCameraParameters& );
    464     int32_t setWaveletDenoise(const QCameraParameters& );
    465     int32_t setZslMode(const QCameraParameters& );
    466     int32_t setZslAttributes(const QCameraParameters& );
    467     int32_t setCameraMode(const QCameraParameters& );
    468     int32_t setFaceRecognition(const QCameraParameters& );
    469     int32_t setFlip(const QCameraParameters& );
    470 
    471     int32_t setAutoExposure(const char *autoExp);
    472     int32_t setPreviewFpsRange(int minFPS,int maxFPS);
    473     int32_t setEffect(const char *effect);
    474     int32_t setBrightness(int brightness);
    475     int32_t setFocusMode(const char *focusMode);
    476     int32_t setSharpness(int sharpness);
    477     int32_t setSaturation(int saturation);
    478     int32_t setContrast(int contrast);
    479     int32_t setSkinToneEnhancement(int sceFactor);
    480     int32_t setSceneDetect(const char *scendDetect);
    481     int32_t setVideoHDR(const char *videoHDR);
    482     int32_t setZoom(int zoom_level);
    483     int32_t setISOValue(const char *isoValue);
    484     int32_t setFlash(const char *flashStr);
    485     int32_t setAecLock(const char *aecStr);
    486     int32_t setAwbLock(const char *awbStr);
    487     int32_t setMCEValue(const char *mceStr);
    488     int32_t setDISValue(const char *disStr);
    489     int32_t setHighFrameRate(const char *hfrStr);
    490     int32_t setLensShadeValue(const char *lensShadeStr);
    491     int32_t setExposureCompensation(int expComp);
    492     int32_t setWhiteBalance(const char *wbStr);
    493     int32_t setAntibanding(const char *antiBandingStr);
    494     int32_t setFocusAreas(const char *focusAreasStr);
    495     int32_t setMeteringAreas(const char *meteringAreasStr);
    496     int32_t setSceneMode(const char *sceneModeStr);
    497     int32_t setSelectableZoneAf(const char *selZoneAFStr);
    498     int32_t setAEBracket(const char *aecBracketStr);
    499     int32_t setRedeyeReduction(const char *redeyeStr);
    500     int32_t setWaveletDenoise(const char *wnrStr);
    501     int32_t setFaceRecognition(const char *faceRecog, int maxFaces);
    502 
    503     int32_t parse_pair(const char *str, int *first, int *second,
    504                        char delim, char **endptr);
    505     void parseSizesList(const char *sizesStr, Vector<Size> &sizes);
    506     int32_t parseNDimVector(const char *str, int *num, int N, char delim);
    507     int32_t parseCameraAreaString(const char *str, int max_num_areas,
    508                                   cam_area_t *pAreas, int& num_areas_found);
    509     bool validateCameraAreas(cam_area_t *areas, int num_areas);
    510     int parseGPSCoordinate(const char *coord_str, rat_t *coord);
    511     int32_t getRational(rat_t *rat, int num, int denom);
    512     String8 createSizesString(const cam_dimension_t *sizes, int len);
    513     String8 createValuesString(const int *values, int len,
    514                                const QCameraMap *map, int map_len);
    515     String8 createValuesStringFromMap(const QCameraMap *map,
    516                                       int map_len);
    517     String8 createHfrValuesString(const cam_hfr_info_t *values, int len,
    518                                   const QCameraMap *map, int map_len);
    519     String8 createHfrSizesString(const cam_hfr_info_t *values, int len);
    520     String8 createFpsRangeString(const cam_fps_range_t *fps,
    521                                  int len,
    522                                  int &default_fps_index);
    523     static int compareFPSValues(const void *p1, const void *p2);
    524     String8 createFpsString(const cam_fps_range_t *fps, int len);
    525     String8 createZoomRatioValuesString(int *zoomRatios, int length);
    526     int lookupAttr(const QCameraMap arr[], int len, const char *name);
    527     const char *lookupNameByValue(const QCameraMap arr[], int len, int value);
    528 
    529     // ops for batch set/get params with server
    530     int32_t initBatchUpdate(parm_buffer_t *p_table);
    531     int32_t AddSetParmEntryToBatch(parm_buffer_t *p_table,
    532                                    cam_intf_parm_type_t paramType,
    533                                    uint32_t paramLength,
    534                                    void *paramValue);
    535     int32_t commitSetBatch();
    536     int32_t AddGetParmEntryToBatch(parm_buffer_t *p_table,
    537                                    cam_intf_parm_type_t paramType);
    538     int32_t commitGetBatch();
    539 
    540     // ops to tempororily update parameter entries and commit
    541     int32_t updateParamEntry(const char *key, const char *value);
    542     int32_t commitParamChanges();
    543 
    544     // Map from strings to values
    545     static const cam_dimension_t THUMBNAIL_SIZES_MAP[];
    546     static const QCameraMap AUTO_EXPOSURE_MAP[];
    547     static const QCameraMap PREVIEW_FORMATS_MAP[];
    548     static const QCameraMap PICTURE_TYPES_MAP[];
    549     static const QCameraMap RAW_FORMATS_MAP[];
    550     static const QCameraMap FOCUS_MODES_MAP[];
    551     static const QCameraMap EFFECT_MODES_MAP[];
    552     static const QCameraMap SCENE_MODES_MAP[];
    553     static const QCameraMap FLASH_MODES_MAP[];
    554     static const QCameraMap FOCUS_ALGO_MAP[];
    555     static const QCameraMap WHITE_BALANCE_MODES_MAP[];
    556     static const QCameraMap ANTIBANDING_MODES_MAP[];
    557     static const QCameraMap ISO_MODES_MAP[];
    558     static const QCameraMap HFR_MODES_MAP[];
    559     static const QCameraMap BRACKETING_MODES_MAP[];
    560     static const QCameraMap ON_OFF_MODES_MAP[];
    561     static const QCameraMap ENABLE_DISABLE_MODES_MAP[];
    562     static const QCameraMap DENOISE_ON_OFF_MODES_MAP[];
    563     static const QCameraMap TRUE_FALSE_MODES_MAP[];
    564     static const QCameraMap TOUCH_AF_AEC_MODES_MAP[];
    565     static const QCameraMap FLIP_MODES_MAP[];
    566 
    567     cam_capability_t *m_pCapability;
    568     mm_camera_vtbl_t *m_pCamOpsTbl;
    569     QCameraHeapMemory *m_pParamHeap;
    570     parm_buffer_t     *m_pParamBuf;  // ptr to param buf in m_pParamHeap
    571 
    572     bool m_bZslMode;                // if ZSL is enabled
    573     bool m_bZslMode_new;
    574     bool m_bRecordingHint;          // local copy of recording hint
    575     bool m_bRecordingHint_new;
    576     bool m_bHistogramEnabled;       // if histogram is enabled
    577     int  m_nFaceProcMask;           // face process mask
    578     bool m_bDebugFps;               // if FPS need to be logged
    579     cam_focus_mode_type mFocusMode;
    580     cam_format_t mPreviewFormat;
    581     int32_t mPictureFormat;         // could be CAMERA_PICTURE_TYPE_JPEG or cam_format_t
    582     bool m_bNeedRestart;            // if preview needs restart after parameters updated
    583     bool m_bNoDisplayMode;
    584     bool m_bWNROn;
    585     bool m_bNeedLockCAF;
    586     bool m_bCAFLocked;
    587     bool m_bAFRunning;
    588     qcamera_thermal_mode m_ThermalMode; // adjust fps vs adjust frameskip
    589     cam_dimension_t m_LiveSnapshotSize; // live snapshot size
    590 
    591     DefaultKeyedVector<String8,String8> m_tempMap; // map for temororily store parameters to be set
    592 };
    593 
    594 }; // namespace qcamera
    595 
    596 #endif
    597