blob: c403574aaa2815807b55ba519f930b3aa3230587 [file] [log] [blame]
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#define LOG_TAG "QCameraParameters"
// To remove
#include <cutils/properties.h>
// System dependencies
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <utils/Errors.h>
#define SYSINFO_H <SYSTEM_HEADER_PREFIX/sysinfo.h>
#include SYSINFO_H
#include "gralloc_priv.h"
#include "graphics.h"
// Camera dependencies
#include "QCameraBufferMaps.h"
#include "QCamera2HWI.h"
#include "QCameraParameters.h"
#include "QCameraTrace.h"
extern "C" {
#include "mm_camera_dbg.h"
}
#define PI 3.14159265
#define ASPECT_TOLERANCE 0.001
#define CAMERA_DEFAULT_LONGSHOT_STAGES 4
#define CAMERA_MIN_LONGSHOT_STAGES 2
#define FOCUS_PERCISION 0.0000001
namespace qcamera {
// Parameter keys to communicate between camera application and driver.
const char QCameraParameters::KEY_QC_SUPPORTED_HFR_SIZES[] = "hfr-size-values";
const char QCameraParameters::KEY_QC_PREVIEW_FRAME_RATE_MODE[] = "preview-frame-rate-mode";
const char QCameraParameters::KEY_QC_SUPPORTED_PREVIEW_FRAME_RATE_MODES[] = "preview-frame-rate-modes";
const char QCameraParameters::KEY_QC_PREVIEW_FRAME_RATE_AUTO_MODE[] = "frame-rate-auto";
const char QCameraParameters::KEY_QC_PREVIEW_FRAME_RATE_FIXED_MODE[] = "frame-rate-fixed";
const char QCameraParameters::KEY_QC_TOUCH_AF_AEC[] = "touch-af-aec";
const char QCameraParameters::KEY_QC_SUPPORTED_TOUCH_AF_AEC[] = "touch-af-aec-values";
const char QCameraParameters::KEY_QC_TOUCH_INDEX_AEC[] = "touch-index-aec";
const char QCameraParameters::KEY_QC_TOUCH_INDEX_AF[] = "touch-index-af";
const char QCameraParameters::KEY_QC_SCENE_DETECT[] = "scene-detect";
const char QCameraParameters::KEY_QC_SUPPORTED_SCENE_DETECT[] = "scene-detect-values";
const char QCameraParameters::KEY_QC_ISO_MODE[] = "iso";
const char QCameraParameters::KEY_QC_CONTINUOUS_ISO[] = "continuous-iso";
const char QCameraParameters::KEY_QC_MIN_ISO[] = "min-iso";
const char QCameraParameters::KEY_QC_MAX_ISO[] = "max-iso";
const char QCameraParameters::KEY_QC_SUPPORTED_ISO_MODES[] = "iso-values";
const char QCameraParameters::KEY_QC_EXPOSURE_TIME[] = "exposure-time";
const char QCameraParameters::KEY_QC_MIN_EXPOSURE_TIME[] = "min-exposure-time";
const char QCameraParameters::KEY_QC_MAX_EXPOSURE_TIME[] = "max-exposure-time";
const char QCameraParameters::KEY_QC_CURRENT_EXPOSURE_TIME[] = "cur-exposure-time";
const char QCameraParameters::KEY_QC_CURRENT_ISO[] = "cur-iso";
const char QCameraParameters::KEY_QC_LENSSHADE[] = "lensshade";
const char QCameraParameters::KEY_QC_SUPPORTED_LENSSHADE_MODES[] = "lensshade-values";
const char QCameraParameters::KEY_QC_AUTO_EXPOSURE[] = "auto-exposure";
const char QCameraParameters::KEY_QC_SUPPORTED_AUTO_EXPOSURE[] = "auto-exposure-values";
const char QCameraParameters::KEY_QC_DENOISE[] = "denoise";
const char QCameraParameters::KEY_QC_SUPPORTED_DENOISE[] = "denoise-values";
const char QCameraParameters::KEY_QC_FOCUS_ALGO[] = "selectable-zone-af";
const char QCameraParameters::KEY_QC_SUPPORTED_FOCUS_ALGOS[] = "selectable-zone-af-values";
const char QCameraParameters::KEY_QC_MANUAL_FOCUS_POSITION[] = "manual-focus-position";
const char QCameraParameters::KEY_QC_MANUAL_FOCUS_POS_TYPE[] = "manual-focus-pos-type";
const char QCameraParameters::KEY_QC_MIN_FOCUS_POS_INDEX[] = "min-focus-pos-index";
const char QCameraParameters::KEY_QC_MAX_FOCUS_POS_INDEX[] = "max-focus-pos-index";
const char QCameraParameters::KEY_QC_MIN_FOCUS_POS_DAC[] = "min-focus-pos-dac";
const char QCameraParameters::KEY_QC_MAX_FOCUS_POS_DAC[] = "max-focus-pos-dac";
const char QCameraParameters::KEY_QC_MIN_FOCUS_POS_RATIO[] = "min-focus-pos-ratio";
const char QCameraParameters::KEY_QC_MAX_FOCUS_POS_RATIO[] = "max-focus-pos-ratio";
const char QCameraParameters::KEY_QC_FOCUS_POSITION_SCALE[] = "cur-focus-scale";
const char QCameraParameters::KEY_QC_MIN_FOCUS_POS_DIOPTER[] = "min-focus-pos-diopter";
const char QCameraParameters::KEY_QC_MAX_FOCUS_POS_DIOPTER[] = "max-focus-pos-diopter";
const char QCameraParameters::KEY_QC_FOCUS_POSITION_DIOPTER[] = "cur-focus-diopter";
const char QCameraParameters::KEY_QC_FACE_DETECTION[] = "face-detection";
const char QCameraParameters::KEY_QC_SUPPORTED_FACE_DETECTION[] = "face-detection-values";
const char QCameraParameters::KEY_QC_FACE_RECOGNITION[] = "face-recognition";
const char QCameraParameters::KEY_QC_SUPPORTED_FACE_RECOGNITION[] = "face-recognition-values";
const char QCameraParameters::KEY_QC_MEMORY_COLOR_ENHANCEMENT[] = "mce";
const char QCameraParameters::KEY_QC_SUPPORTED_MEM_COLOR_ENHANCE_MODES[] = "mce-values";
const char QCameraParameters::KEY_QC_DIS[] = "dis";
const char QCameraParameters::KEY_QC_OIS[] = "ois";
const char QCameraParameters::KEY_QC_SUPPORTED_DIS_MODES[] = "dis-values";
const char QCameraParameters::KEY_QC_SUPPORTED_OIS_MODES[] = "ois-values";
const char QCameraParameters::KEY_QC_VIDEO_HIGH_FRAME_RATE[] = "video-hfr";
const char QCameraParameters::KEY_QC_VIDEO_HIGH_SPEED_RECORDING[] = "video-hsr";
const char QCameraParameters::KEY_QC_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[] = "video-hfr-values";
const char QCameraParameters::KEY_QC_REDEYE_REDUCTION[] = "redeye-reduction";
const char QCameraParameters::KEY_QC_SUPPORTED_REDEYE_REDUCTION[] = "redeye-reduction-values";
const char QCameraParameters::KEY_QC_HIGH_DYNAMIC_RANGE_IMAGING[] = "hdr";
const char QCameraParameters::KEY_QC_SUPPORTED_HDR_IMAGING_MODES[] = "hdr-values";
const char QCameraParameters::KEY_QC_ZSL[] = "zsl";
const char QCameraParameters::KEY_QC_SUPPORTED_ZSL_MODES[] = "zsl-values";
const char QCameraParameters::KEY_QC_ZSL_BURST_INTERVAL[] = "capture-burst-interval";
const char QCameraParameters::KEY_QC_ZSL_BURST_LOOKBACK[] = "capture-burst-retroactive";
const char QCameraParameters::KEY_QC_ZSL_QUEUE_DEPTH[] = "capture-burst-queue-depth";
const char QCameraParameters::KEY_QC_CAMERA_MODE[] = "camera-mode";
const char QCameraParameters::KEY_QC_AE_BRACKET_HDR[] = "ae-bracket-hdr";
const char QCameraParameters::KEY_QC_SUPPORTED_AE_BRACKET_MODES[] = "ae-bracket-hdr-values";
const char QCameraParameters::KEY_QC_SUPPORTED_RAW_FORMATS[] = "raw-format-values";
const char QCameraParameters::KEY_QC_RAW_FORMAT[] = "raw-format";
const char QCameraParameters::KEY_QC_ORIENTATION[] = "orientation";
const char QCameraParameters::KEY_QC_SELECTABLE_ZONE_AF[] = "selectable-zone-af";
const char QCameraParameters::KEY_QC_CAPTURE_BURST_EXPOSURE[] = "capture-burst-exposures";
const char QCameraParameters::KEY_QC_NUM_SNAPSHOT_PER_SHUTTER[] = "num-snaps-per-shutter";
const char QCameraParameters::KEY_QC_NUM_RETRO_BURST_PER_SHUTTER[] = "num-retro-burst-per-shutter";
const char QCameraParameters::KEY_QC_SNAPSHOT_BURST_LED_ON_PERIOD[] = "zsl-burst-led-on-period";
const char QCameraParameters::KEY_QC_NO_DISPLAY_MODE[] = "no-display-mode";
const char QCameraParameters::KEY_QC_RAW_PICUTRE_SIZE[] = "raw-size";
const char QCameraParameters::KEY_QC_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] = "skinToneEnhancement-values";
const char QCameraParameters::KEY_QC_SUPPORTED_LIVESNAPSHOT_SIZES[] = "supported-live-snapshot-sizes";
const char QCameraParameters::KEY_QC_SUPPORTED_HDR_NEED_1X[] = "hdr-need-1x-values";
const char QCameraParameters::KEY_QC_HDR_NEED_1X[] = "hdr-need-1x";
const char QCameraParameters::KEY_QC_PREVIEW_FLIP[] = "preview-flip";
const char QCameraParameters::KEY_QC_VIDEO_FLIP[] = "video-flip";
const char QCameraParameters::KEY_QC_SNAPSHOT_PICTURE_FLIP[] = "snapshot-picture-flip";
const char QCameraParameters::KEY_QC_SUPPORTED_FLIP_MODES[] = "flip-mode-values";
const char QCameraParameters::KEY_QC_VIDEO_HDR[] = "video-hdr";
const char QCameraParameters::KEY_QC_SENSOR_HDR[] = "sensor-hdr";
const char QCameraParameters::KEY_QC_VT_ENABLE[] = "avtimer";
const char QCameraParameters::KEY_QC_SUPPORTED_VIDEO_HDR_MODES[] = "video-hdr-values";
const char QCameraParameters::KEY_QC_SUPPORTED_SENSOR_HDR_MODES[] = "sensor-hdr-values";
const char QCameraParameters::KEY_QC_AUTO_HDR_ENABLE [] = "auto-hdr-enable";
const char QCameraParameters::KEY_QC_SNAPSHOT_BURST_NUM[] = "snapshot-burst-num";
const char QCameraParameters::KEY_QC_SNAPSHOT_FD_DATA[] = "snapshot-fd-data-enable";
const char QCameraParameters::KEY_QC_TINTLESS_ENABLE[] = "tintless";
const char QCameraParameters::KEY_QC_SCENE_SELECTION[] = "scene-selection";
const char QCameraParameters::KEY_QC_CDS_MODE[] = "cds-mode";
const char QCameraParameters::KEY_QC_VIDEO_CDS_MODE[] = "video-cds-mode";
const char QCameraParameters::KEY_QC_SUPPORTED_CDS_MODES[] = "cds-mode-values";
const char QCameraParameters::KEY_QC_SUPPORTED_VIDEO_CDS_MODES[] = "video-cds-mode-values";
const char QCameraParameters::KEY_QC_TNR_MODE[] = "tnr-mode";
const char QCameraParameters::KEY_QC_VIDEO_TNR_MODE[] = "video-tnr-mode";
const char QCameraParameters::KEY_QC_SUPPORTED_TNR_MODES[] = "tnr-mode-values";
const char QCameraParameters::KEY_QC_SUPPORTED_VIDEO_TNR_MODES[] = "video-tnr-mode-values";
const char QCameraParameters::KEY_QC_VIDEO_ROTATION[] = "video-rotation";
const char QCameraParameters::KEY_QC_SUPPORTED_VIDEO_ROTATION_VALUES[] = "video-rotation-values";
const char QCameraParameters::KEY_QC_AF_BRACKET[] = "af-bracket";
const char QCameraParameters::KEY_QC_SUPPORTED_AF_BRACKET_MODES[] = "af-bracket-values";
const char QCameraParameters::KEY_QC_RE_FOCUS[] = "re-focus";
const char QCameraParameters::KEY_QC_SUPPORTED_RE_FOCUS_MODES[] = "re-focus-values";
const char QCameraParameters::KEY_QC_CHROMA_FLASH[] = "chroma-flash";
const char QCameraParameters::KEY_QC_SUPPORTED_CHROMA_FLASH_MODES[] = "chroma-flash-values";
const char QCameraParameters::KEY_QC_OPTI_ZOOM[] = "opti-zoom";
const char QCameraParameters::KEY_QC_SEE_MORE[] = "see-more";
const char QCameraParameters::KEY_QC_STILL_MORE[] = "still-more";
const char QCameraParameters::KEY_QC_SUPPORTED_OPTI_ZOOM_MODES[] = "opti-zoom-values";
const char QCameraParameters::KEY_QC_HDR_MODE[] = "hdr-mode";
const char QCameraParameters::KEY_QC_SUPPORTED_KEY_QC_HDR_MODES[] = "hdr-mode-values";
const char QCameraParameters::KEY_QC_TRUE_PORTRAIT[] = "true-portrait";
const char QCameraParameters::KEY_QC_SUPPORTED_TRUE_PORTRAIT_MODES[] = "true-portrait-values";
const char QCameraParameters::KEY_QC_SUPPORTED_SEE_MORE_MODES[] = "see-more-values";
const char QCameraParameters::KEY_QC_SUPPORTED_STILL_MORE_MODES[] = "still-more-values";
const char QCameraParameters::KEY_INTERNAL_PERVIEW_RESTART[] = "internal-restart";
const char QCameraParameters::KEY_QC_RDI_MODE[] = "rdi-mode";
const char QCameraParameters::KEY_QC_SUPPORTED_RDI_MODES[] = "rdi-mode-values";
const char QCameraParameters::KEY_QC_SECURE_MODE[] = "secure-mode";
const char QCameraParameters::KEY_QC_SUPPORTED_SECURE_MODES[] = "secure-mode-values";
const char QCameraParameters::ISO_HJR[] = "ISO_HJR";
const char QCameraParameters::KEY_QC_AUTO_HDR_SUPPORTED[] = "auto-hdr-supported";
const char QCameraParameters::KEY_QC_LONGSHOT_SUPPORTED[] = "longshot-supported";
const char QCameraParameters::KEY_QC_ZSL_HDR_SUPPORTED[] = "zsl-hdr-supported";
const char QCameraParameters::KEY_QC_WB_MANUAL_CCT[] = "wb-manual-cct";
const char QCameraParameters::KEY_QC_MIN_WB_CCT[] = "min-wb-cct";
const char QCameraParameters::KEY_QC_MAX_WB_CCT[] = "max-wb-cct";
const char QCameraParameters::KEY_QC_MANUAL_WB_GAINS[] = "manual-wb-gains";
const char QCameraParameters::KEY_QC_MIN_WB_GAIN[] = "min-wb-gain";
const char QCameraParameters::KEY_QC_MAX_WB_GAIN[] = "max-wb-gain";
const char QCameraParameters::KEY_QC_MANUAL_WB_TYPE[] = "manual-wb-type";
const char QCameraParameters::KEY_QC_MANUAL_WB_VALUE[] = "manual-wb-value";
const char QCameraParameters::WHITE_BALANCE_MANUAL[] = "manual";
const char QCameraParameters::FOCUS_MODE_MANUAL_POSITION[] = "manual";
const char QCameraParameters::KEY_QC_CACHE_VIDEO_BUFFERS[] = "cache-video-buffers";
const char QCameraParameters::KEY_QC_LONG_SHOT[] = "long-shot";
const char QCameraParameters::KEY_QC_INITIAL_EXPOSURE_INDEX[] = "initial-exp-index";
const char QCameraParameters::KEY_QC_INSTANT_AEC[] = "instant-aec";
const char QCameraParameters::KEY_QC_INSTANT_CAPTURE[] = "instant-capture";
const char QCameraParameters::KEY_QC_INSTANT_AEC_SUPPORTED_MODES[] = "instant-aec-values";
const char QCameraParameters::KEY_QC_INSTANT_CAPTURE_SUPPORTED_MODES[] = "instant-capture-values";
// Values for effect settings.
const char QCameraParameters::EFFECT_EMBOSS[] = "emboss";
const char QCameraParameters::EFFECT_SKETCH[] = "sketch";
const char QCameraParameters::EFFECT_NEON[] = "neon";
const char QCameraParameters::EFFECT_BEAUTY[] = "beauty";
// Values for auto exposure settings.
const char QCameraParameters::TOUCH_AF_AEC_OFF[] = "touch-off";
const char QCameraParameters::TOUCH_AF_AEC_ON[] = "touch-on";
// Values for scene mode settings.
const char QCameraParameters::SCENE_MODE_ASD[] = "asd"; // corresponds to CAMERA_BESTSHOT_AUTO in HAL
const char QCameraParameters::SCENE_MODE_BACKLIGHT[] = "backlight";
const char QCameraParameters::SCENE_MODE_FLOWERS[] = "flowers";
const char QCameraParameters::SCENE_MODE_AR[] = "AR";
const char QCameraParameters::SCENE_MODE_HDR[] = "hdr";
// Formats for setPreviewFormat and setPictureFormat.
const char QCameraParameters::PIXEL_FORMAT_YUV420SP_ADRENO[] = "yuv420sp-adreno";
const char QCameraParameters::PIXEL_FORMAT_YV12[] = "yuv420p";
const char QCameraParameters::PIXEL_FORMAT_NV12[] = "nv12";
const char QCameraParameters::QC_PIXEL_FORMAT_NV12_VENUS[] = "nv12-venus";
// Values for raw image formats
const char QCameraParameters::QC_PIXEL_FORMAT_YUV_RAW_8BIT_YUYV[] = "yuv-raw8-yuyv";
const char QCameraParameters::QC_PIXEL_FORMAT_YUV_RAW_8BIT_YVYU[] = "yuv-raw8-yvyu";
const char QCameraParameters::QC_PIXEL_FORMAT_YUV_RAW_8BIT_UYVY[] = "yuv-raw8-uyvy";
const char QCameraParameters::QC_PIXEL_FORMAT_YUV_RAW_8BIT_VYUY[] = "yuv-raw8-vyuy";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GBRG[] = "bayer-qcom-8gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GRBG[] = "bayer-qcom-8grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8RGGB[] = "bayer-qcom-8rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8BGGR[] = "bayer-qcom-8bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GBRG[] = "bayer-qcom-10gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GRBG[] = "bayer-qcom-10grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10RGGB[] = "bayer-qcom-10rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10BGGR[] = "bayer-qcom-10bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GBRG[] = "bayer-qcom-12gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GRBG[] = "bayer-qcom-12grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12RGGB[] = "bayer-qcom-12rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12BGGR[] = "bayer-qcom-12bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14GBRG[] = "bayer-qcom-14gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14GRBG[] = "bayer-qcom-14grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14RGGB[] = "bayer-qcom-14rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14BGGR[] = "bayer-qcom-14bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GBRG[] = "bayer-mipi-8gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GRBG[] = "bayer-mipi-8grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8RGGB[] = "bayer-mipi-8rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8BGGR[] = "bayer-mipi-8bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GBRG[] = "bayer-mipi-10gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GRBG[] = "bayer-mipi-10grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10RGGB[] = "bayer-mipi-10rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10BGGR[] = "bayer-mipi-10bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GBRG[] = "bayer-mipi-12gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GRBG[] = "bayer-mipi-12grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12RGGB[] = "bayer-mipi-12rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12BGGR[] = "bayer-mipi-12bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14GBRG[] = "bayer-mipi-14gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14GRBG[] = "bayer-mipi-14grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14RGGB[] = "bayer-mipi-14rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14BGGR[] = "bayer-mipi-14bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GBRG[] = "bayer-ideal-qcom-8gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GRBG[] = "bayer-ideal-qcom-8grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8RGGB[] = "bayer-ideal-qcom-8rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8BGGR[] = "bayer-ideal-qcom-8bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GBRG[] = "bayer-ideal-qcom-10gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GRBG[] = "bayer-ideal-qcom-10grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10RGGB[] = "bayer-ideal-qcom-10rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10BGGR[] = "bayer-ideal-qcom-10bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GBRG[] = "bayer-ideal-qcom-12gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GRBG[] = "bayer-ideal-qcom-12grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12RGGB[] = "bayer-ideal-qcom-12rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12BGGR[] = "bayer-ideal-qcom-12bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14GBRG[] = "bayer-ideal-qcom-14gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14GRBG[] = "bayer-ideal-qcom-14grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14RGGB[] = "bayer-ideal-qcom-14rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14BGGR[] = "bayer-ideal-qcom-14bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GBRG[] = "bayer-ideal-mipi-8gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GRBG[] = "bayer-ideal-mipi-8grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8RGGB[] = "bayer-ideal-mipi-8rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8BGGR[] = "bayer-ideal-mipi-8bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GBRG[] = "bayer-ideal-mipi-10gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GRBG[] = "bayer-ideal-mipi-10grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10RGGB[] = "bayer-ideal-mipi-10rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10BGGR[] = "bayer-ideal-mipi-10bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GBRG[] = "bayer-ideal-mipi-12gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GRBG[] = "bayer-ideal-mipi-12grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12RGGB[] = "bayer-ideal-mipi-12rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12BGGR[] = "bayer-ideal-mipi-12bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14GBRG[] = "bayer-ideal-mipi-14gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14GRBG[] = "bayer-ideal-mipi-14grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14RGGB[] = "bayer-ideal-mipi-14rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14BGGR[] = "bayer-ideal-mipi-14bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GBRG[] = "bayer-ideal-plain8-8gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GRBG[] = "bayer-ideal-plain8-8grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8RGGB[] = "bayer-ideal-plain8-8rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8BGGR[] = "bayer-ideal-plain8-8bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GBRG[] = "bayer-ideal-plain16-8gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GRBG[] = "bayer-ideal-plain16-8grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8RGGB[] = "bayer-ideal-plain16-8rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8BGGR[] = "bayer-ideal-plain16-8bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GBRG[] = "bayer-ideal-plain16-10gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GRBG[] = "bayer-ideal-plain16-10grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10RGGB[] = "bayer-ideal-plain16-10rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10BGGR[] = "bayer-ideal-plain16-10bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GBRG[] = "bayer-ideal-plain16-12gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GRBG[] = "bayer-ideal-plain16-12grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12RGGB[] = "bayer-ideal-plain16-12rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12BGGR[] = "bayer-ideal-plain16-12bggr";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14GBRG[] = "bayer-ideal-plain16-14gbrg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14GRBG[] = "bayer-ideal-plain16-14grbg";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14RGGB[] = "bayer-ideal-plain16-14rggb";
const char QCameraParameters::QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14BGGR[] = "bayer-ideal-plain16-14bggr";
// Values for ISO Settings
const char QCameraParameters::ISO_AUTO[] = "auto";
const char QCameraParameters::ISO_100[] = "ISO100";
const char QCameraParameters::ISO_200[] = "ISO200";
const char QCameraParameters::ISO_400[] = "ISO400";
const char QCameraParameters::ISO_800[] = "ISO800";
const char QCameraParameters::ISO_1600[] = "ISO1600";
const char QCameraParameters::ISO_3200[] = "ISO3200";
const char QCameraParameters::ISO_MANUAL[] = "manual";
// Values for auto exposure settings.
const char QCameraParameters::AUTO_EXPOSURE_FRAME_AVG[] = "frame-average";
const char QCameraParameters::AUTO_EXPOSURE_CENTER_WEIGHTED[] = "center-weighted";
const char QCameraParameters::AUTO_EXPOSURE_SPOT_METERING[] = "spot-metering";
const char QCameraParameters::AUTO_EXPOSURE_SMART_METERING[] = "smart-metering";
const char QCameraParameters::AUTO_EXPOSURE_USER_METERING[] = "user-metering";
const char QCameraParameters::AUTO_EXPOSURE_SPOT_METERING_ADV[] = "spot-metering-adv";
const char QCameraParameters::AUTO_EXPOSURE_CENTER_WEIGHTED_ADV[] = "center-weighted-adv";
// Values for instant AEC modes
const char QCameraParameters::KEY_QC_INSTANT_AEC_DISABLE[] = "0";
const char QCameraParameters::KEY_QC_INSTANT_AEC_AGGRESSIVE_AEC[] = "1";
const char QCameraParameters::KEY_QC_INSTANT_AEC_FAST_AEC[] = "2";
// Values for instant capture modes
const char QCameraParameters::KEY_QC_INSTANT_CAPTURE_DISABLE[] = "0";
const char QCameraParameters::KEY_QC_INSTANT_CAPTURE_AGGRESSIVE_AEC[] = "1";
const char QCameraParameters::KEY_QC_INSTANT_CAPTURE_FAST_AEC[] = "2";
const char QCameraParameters::KEY_QC_GPS_LATITUDE_REF[] = "gps-latitude-ref";
const char QCameraParameters::KEY_QC_GPS_LONGITUDE_REF[] = "gps-longitude-ref";
const char QCameraParameters::KEY_QC_GPS_ALTITUDE_REF[] = "gps-altitude-ref";
const char QCameraParameters::KEY_QC_GPS_STATUS[] = "gps-status";
const char QCameraParameters::KEY_QC_HISTOGRAM[] = "histogram";
const char QCameraParameters::KEY_QC_SUPPORTED_HISTOGRAM_MODES[] = "histogram-values";
const char QCameraParameters::VALUE_ENABLE[] = "enable";
const char QCameraParameters::VALUE_DISABLE[] = "disable";
const char QCameraParameters::VALUE_OFF[] = "off";
const char QCameraParameters::VALUE_ON[] = "on";
const char QCameraParameters::VALUE_TRUE[] = "true";
const char QCameraParameters::VALUE_FALSE[] = "false";
const char QCameraParameters::VALUE_FAST[] = "fast";
const char QCameraParameters::VALUE_HIGH_QUALITY[] = "high-quality";
const char QCameraParameters::KEY_QC_SHARPNESS[] = "sharpness";
const char QCameraParameters::KEY_QC_MIN_SHARPNESS[] = "min-sharpness";
const char QCameraParameters::KEY_QC_MAX_SHARPNESS[] = "max-sharpness";
const char QCameraParameters::KEY_QC_SHARPNESS_STEP[] = "sharpness-step";
const char QCameraParameters::KEY_QC_CONTRAST[] = "contrast";
const char QCameraParameters::KEY_QC_MIN_CONTRAST[] = "min-contrast";
const char QCameraParameters::KEY_QC_MAX_CONTRAST[] = "max-contrast";
const char QCameraParameters::KEY_QC_CONTRAST_STEP[] = "contrast-step";
const char QCameraParameters::KEY_QC_SATURATION[] = "saturation";
const char QCameraParameters::KEY_QC_MIN_SATURATION[] = "min-saturation";
const char QCameraParameters::KEY_QC_MAX_SATURATION[] = "max-saturation";
const char QCameraParameters::KEY_QC_SATURATION_STEP[] = "saturation-step";
const char QCameraParameters::KEY_QC_BRIGHTNESS[] = "luma-adaptation";
const char QCameraParameters::KEY_QC_MIN_BRIGHTNESS[] = "min-brightness";
const char QCameraParameters::KEY_QC_MAX_BRIGHTNESS[] = "max-brightness";
const char QCameraParameters::KEY_QC_BRIGHTNESS_STEP[] = "brightness-step";
const char QCameraParameters::KEY_QC_SCE_FACTOR[] = "skinToneEnhancement";
const char QCameraParameters::KEY_QC_MIN_SCE_FACTOR[] = "min-sce-factor";
const char QCameraParameters::KEY_QC_MAX_SCE_FACTOR[] = "max-sce-factor";
const char QCameraParameters::KEY_QC_SCE_FACTOR_STEP[] = "sce-factor-step";
const char QCameraParameters::KEY_QC_MAX_NUM_REQUESTED_FACES[] = "qc-max-num-requested-faces";
//Values for DENOISE
const char QCameraParameters::DENOISE_OFF[] = "denoise-off";
const char QCameraParameters::DENOISE_ON[] = "denoise-on";
// Values for selectable zone af Settings
const char QCameraParameters::FOCUS_ALGO_AUTO[] = "auto";
const char QCameraParameters::FOCUS_ALGO_SPOT_METERING[] = "spot-metering";
const char QCameraParameters::FOCUS_ALGO_CENTER_WEIGHTED[] = "center-weighted";
const char QCameraParameters::FOCUS_ALGO_FRAME_AVERAGE[] = "frame-average";
// Values for HFR settings.
const char QCameraParameters::VIDEO_HFR_OFF[] = "off";
const char QCameraParameters::VIDEO_HFR_2X[] = "60";
const char QCameraParameters::VIDEO_HFR_3X[] = "90";
const char QCameraParameters::VIDEO_HFR_4X[] = "120";
const char QCameraParameters::VIDEO_HFR_5X[] = "150";
const char QCameraParameters::VIDEO_HFR_6X[] = "180";
const char QCameraParameters::VIDEO_HFR_7X[] = "210";
const char QCameraParameters::VIDEO_HFR_8X[] = "240";
const char QCameraParameters::VIDEO_HFR_9X[] = "480";
// Values for HDR Bracketing settings.
const char QCameraParameters::AE_BRACKET_OFF[] = "Off";
const char QCameraParameters::AE_BRACKET[] = "AE-Bracket";
// Values for AF Bracketing setting.
const char QCameraParameters::AF_BRACKET_OFF[] = "af-bracket-off";
const char QCameraParameters::AF_BRACKET_ON[] = "af-bracket-on";
// Values for Refocus setting.
const char QCameraParameters::RE_FOCUS_OFF[] = "re-focus-off";
const char QCameraParameters::RE_FOCUS_ON[] = "re-focus-on";
// Values for Chroma Flash setting.
const char QCameraParameters::CHROMA_FLASH_OFF[] = "chroma-flash-off";
const char QCameraParameters::CHROMA_FLASH_ON[] = "chroma-flash-on";
// Values for Opti Zoom setting.
const char QCameraParameters::OPTI_ZOOM_OFF[] = "opti-zoom-off";
const char QCameraParameters::OPTI_ZOOM_ON[] = "opti-zoom-on";
// Values for Still More setting.
const char QCameraParameters::STILL_MORE_OFF[] = "still-more-off";
const char QCameraParameters::STILL_MORE_ON[] = "still-more-on";
// Values for HDR mode setting.
const char QCameraParameters::HDR_MODE_SENSOR[] = "hdr-mode-sensor";
const char QCameraParameters::HDR_MODE_MULTI_FRAME[] = "hdr-mode-multiframe";
// Values for True Portrait setting.
const char QCameraParameters::TRUE_PORTRAIT_OFF[] = "true-portrait-off";
const char QCameraParameters::TRUE_PORTRAIT_ON[] = "true-portrait-on";
// Values for FLIP settings.
const char QCameraParameters::FLIP_MODE_OFF[] = "off";
const char QCameraParameters::FLIP_MODE_V[] = "flip-v";
const char QCameraParameters::FLIP_MODE_H[] = "flip-h";
const char QCameraParameters::FLIP_MODE_VH[] = "flip-vh";
const char QCameraParameters::CDS_MODE_OFF[] = "off";
const char QCameraParameters::CDS_MODE_ON[] = "on";
const char QCameraParameters::CDS_MODE_AUTO[] = "auto";
// Values for video rotation settings.
const char QCameraParameters::VIDEO_ROTATION_0[] = "0";
const char QCameraParameters::VIDEO_ROTATION_90[] = "90";
const char QCameraParameters::VIDEO_ROTATION_180[] = "180";
const char QCameraParameters::VIDEO_ROTATION_270[] = "270";
const char QCameraParameters::KEY_QC_SUPPORTED_MANUAL_FOCUS_MODES[] = "manual-focus-modes";
const char QCameraParameters::KEY_QC_SUPPORTED_MANUAL_EXPOSURE_MODES[] = "manual-exposure-modes";
const char QCameraParameters::KEY_QC_SUPPORTED_MANUAL_WB_MODES[] = "manual-wb-modes";
const char QCameraParameters::KEY_QC_FOCUS_SCALE_MODE[] = "scale-mode";
const char QCameraParameters::KEY_QC_FOCUS_DIOPTER_MODE[] = "diopter-mode";
const char QCameraParameters::KEY_QC_ISO_PRIORITY[] = "iso-priority";
const char QCameraParameters::KEY_QC_EXP_TIME_PRIORITY[] = "exp-time-priority";
const char QCameraParameters::KEY_QC_USER_SETTING[] = "user-setting";
const char QCameraParameters::KEY_QC_WB_CCT_MODE[] = "color-temperature";
const char QCameraParameters::KEY_QC_WB_GAIN_MODE[] = "rbgb-gains";
const char QCameraParameters::KEY_QC_NOISE_REDUCTION_MODE[] = "noise-reduction-mode";
const char QCameraParameters::KEY_QC_NOISE_REDUCTION_MODE_VALUES[] = "noise-reduction-mode-values";
#ifdef TARGET_TS_MAKEUP
const char QCameraParameters::KEY_TS_MAKEUP[] = "tsmakeup";
const char QCameraParameters::KEY_TS_MAKEUP_WHITEN[] = "tsmakeup_whiten";
const char QCameraParameters::KEY_TS_MAKEUP_CLEAN[] = "tsmakeup_clean";
#endif
//KEY to share HFR batch size with video encoder.
const char QCameraParameters::KEY_QC_VIDEO_BATCH_SIZE[] = "video-batch-size";
static const char* portrait = "portrait";
static const char* landscape = "landscape";
const cam_dimension_t QCameraParameters::THUMBNAIL_SIZES_MAP[] = {
{ 256, 154 }, //1.66233
{ 240, 160 }, //1.5
{ 320, 320 }, //1.0
{ 320, 240 }, //1.33333
{ 256, 144 }, //1.777778
{ 240, 144 }, //1.666667
{ 176, 144 }, //1.222222
/*Thumbnail sizes to match portrait picture size aspect ratio*/
{ 240, 320 }, //to match 480X640 & 240X320 picture size
{ 144, 176 }, //to match 144X176 picture size
{ 0, 0 } // required by Android SDK
};
const QCameraParameters::QCameraMap<cam_auto_exposure_mode_type>
QCameraParameters::AUTO_EXPOSURE_MAP[] = {
{ AUTO_EXPOSURE_FRAME_AVG, CAM_AEC_MODE_FRAME_AVERAGE },
{ AUTO_EXPOSURE_CENTER_WEIGHTED, CAM_AEC_MODE_CENTER_WEIGHTED },
{ AUTO_EXPOSURE_SPOT_METERING, CAM_AEC_MODE_SPOT_METERING },
{ AUTO_EXPOSURE_SMART_METERING, CAM_AEC_MODE_SMART_METERING },
{ AUTO_EXPOSURE_USER_METERING, CAM_AEC_MODE_USER_METERING },
{ AUTO_EXPOSURE_SPOT_METERING_ADV, CAM_AEC_MODE_SPOT_METERING_ADV },
{ AUTO_EXPOSURE_CENTER_WEIGHTED_ADV, CAM_AEC_MODE_CENTER_WEIGHTED_ADV },
};
const QCameraParameters::QCameraMap<cam_aec_convergence_type>
QCameraParameters::INSTANT_AEC_MODES_MAP[] = {
{ KEY_QC_INSTANT_AEC_DISABLE, CAM_AEC_NORMAL_CONVERGENCE },
{ KEY_QC_INSTANT_AEC_AGGRESSIVE_AEC, CAM_AEC_AGGRESSIVE_CONVERGENCE },
{ KEY_QC_INSTANT_AEC_FAST_AEC, CAM_AEC_FAST_CONVERGENCE },
};
const QCameraParameters::QCameraMap<cam_aec_convergence_type>
QCameraParameters::INSTANT_CAPTURE_MODES_MAP[] = {
{ KEY_QC_INSTANT_CAPTURE_DISABLE, CAM_AEC_NORMAL_CONVERGENCE },
{ KEY_QC_INSTANT_CAPTURE_AGGRESSIVE_AEC, CAM_AEC_AGGRESSIVE_CONVERGENCE },
{ KEY_QC_INSTANT_CAPTURE_FAST_AEC, CAM_AEC_FAST_CONVERGENCE },
};
const QCameraParameters::QCameraMap<cam_format_t>
QCameraParameters::PREVIEW_FORMATS_MAP[] = {
{PIXEL_FORMAT_YUV420SP, CAM_FORMAT_YUV_420_NV21},
{PIXEL_FORMAT_YUV420P, CAM_FORMAT_YUV_420_YV12},
{PIXEL_FORMAT_YUV420SP_ADRENO, CAM_FORMAT_YUV_420_NV21_ADRENO},
{PIXEL_FORMAT_YV12, CAM_FORMAT_YUV_420_YV12},
{PIXEL_FORMAT_NV12, CAM_FORMAT_YUV_420_NV12},
{QC_PIXEL_FORMAT_NV12_VENUS, CAM_FORMAT_YUV_420_NV12_VENUS}
};
const QCameraParameters::QCameraMap<cam_format_t>
QCameraParameters::PICTURE_TYPES_MAP[] = {
{PIXEL_FORMAT_JPEG, CAM_FORMAT_JPEG},
{PIXEL_FORMAT_YUV420SP, CAM_FORMAT_YUV_420_NV21},
{PIXEL_FORMAT_YUV422SP, CAM_FORMAT_YUV_422_NV16},
{QC_PIXEL_FORMAT_YUV_RAW_8BIT_YUYV, CAM_FORMAT_YUV_RAW_8BIT_YUYV},
{QC_PIXEL_FORMAT_YUV_RAW_8BIT_YVYU, CAM_FORMAT_YUV_RAW_8BIT_YVYU},
{QC_PIXEL_FORMAT_YUV_RAW_8BIT_UYVY, CAM_FORMAT_YUV_RAW_8BIT_UYVY},
{QC_PIXEL_FORMAT_YUV_RAW_8BIT_VYUY, CAM_FORMAT_YUV_RAW_8BIT_VYUY},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GBRG, CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GRBG, CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8RGGB, CAM_FORMAT_BAYER_QCOM_RAW_8BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8BGGR, CAM_FORMAT_BAYER_QCOM_RAW_8BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GBRG, CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GRBG, CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10RGGB, CAM_FORMAT_BAYER_QCOM_RAW_10BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10BGGR, CAM_FORMAT_BAYER_QCOM_RAW_10BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GBRG, CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GRBG, CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12RGGB, CAM_FORMAT_BAYER_QCOM_RAW_12BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12BGGR, CAM_FORMAT_BAYER_QCOM_RAW_12BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14GBRG, CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14GRBG, CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14RGGB, CAM_FORMAT_BAYER_QCOM_RAW_14BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_QCOM_RAW_14BGGR, CAM_FORMAT_BAYER_QCOM_RAW_14BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GBRG, CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GRBG, CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8RGGB, CAM_FORMAT_BAYER_MIPI_RAW_8BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8BGGR, CAM_FORMAT_BAYER_MIPI_RAW_8BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GBRG, CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GRBG, CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10RGGB, CAM_FORMAT_BAYER_MIPI_RAW_10BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10BGGR, CAM_FORMAT_BAYER_MIPI_RAW_10BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GBRG, CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GRBG, CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12RGGB, CAM_FORMAT_BAYER_MIPI_RAW_12BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12BGGR, CAM_FORMAT_BAYER_MIPI_RAW_12BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14GBRG, CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14GRBG, CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14RGGB, CAM_FORMAT_BAYER_MIPI_RAW_14BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_MIPI_RAW_14BGGR, CAM_FORMAT_BAYER_MIPI_RAW_14BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_14BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_14BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_BGGR},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14GBRG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_GBRG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14GRBG, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_GRBG},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14RGGB, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_RGGB},
{QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_14BGGR, CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_BGGR}
};
const QCameraParameters::QCameraMap<cam_focus_mode_type>
QCameraParameters::FOCUS_MODES_MAP[] = {
{ FOCUS_MODE_AUTO, CAM_FOCUS_MODE_AUTO },
{ FOCUS_MODE_INFINITY, CAM_FOCUS_MODE_INFINITY },
{ FOCUS_MODE_MACRO, CAM_FOCUS_MODE_MACRO },
{ FOCUS_MODE_FIXED, CAM_FOCUS_MODE_FIXED },
{ FOCUS_MODE_EDOF, CAM_FOCUS_MODE_EDOF },
{ FOCUS_MODE_CONTINUOUS_PICTURE, CAM_FOCUS_MODE_CONTINOUS_PICTURE },
{ FOCUS_MODE_CONTINUOUS_VIDEO, CAM_FOCUS_MODE_CONTINOUS_VIDEO },
{ FOCUS_MODE_MANUAL_POSITION, CAM_FOCUS_MODE_MANUAL},
};
const QCameraParameters::QCameraMap<cam_effect_mode_type>
QCameraParameters::EFFECT_MODES_MAP[] = {
{ EFFECT_NONE, CAM_EFFECT_MODE_OFF },
{ EFFECT_MONO, CAM_EFFECT_MODE_MONO },
{ EFFECT_NEGATIVE, CAM_EFFECT_MODE_NEGATIVE },
{ EFFECT_SOLARIZE, CAM_EFFECT_MODE_SOLARIZE },
{ EFFECT_SEPIA, CAM_EFFECT_MODE_SEPIA },
{ EFFECT_POSTERIZE, CAM_EFFECT_MODE_POSTERIZE },
{ EFFECT_WHITEBOARD, CAM_EFFECT_MODE_WHITEBOARD },
{ EFFECT_BLACKBOARD, CAM_EFFECT_MODE_BLACKBOARD },
{ EFFECT_AQUA, CAM_EFFECT_MODE_AQUA },
{ EFFECT_EMBOSS, CAM_EFFECT_MODE_EMBOSS },
{ EFFECT_SKETCH, CAM_EFFECT_MODE_SKETCH },
{ EFFECT_NEON, CAM_EFFECT_MODE_NEON },
{ EFFECT_BEAUTY, CAM_EFFECT_MODE_BEAUTY }
};
const QCameraParameters::QCameraMap<cam_scene_mode_type>
QCameraParameters::SCENE_MODES_MAP[] = {
{ SCENE_MODE_AUTO, CAM_SCENE_MODE_OFF },
{ SCENE_MODE_ACTION, CAM_SCENE_MODE_ACTION },
{ SCENE_MODE_PORTRAIT, CAM_SCENE_MODE_PORTRAIT },
{ SCENE_MODE_LANDSCAPE, CAM_SCENE_MODE_LANDSCAPE },
{ SCENE_MODE_NIGHT, CAM_SCENE_MODE_NIGHT },
{ SCENE_MODE_NIGHT_PORTRAIT, CAM_SCENE_MODE_NIGHT_PORTRAIT },
{ SCENE_MODE_THEATRE, CAM_SCENE_MODE_THEATRE },
{ SCENE_MODE_BEACH, CAM_SCENE_MODE_BEACH },
{ SCENE_MODE_SNOW, CAM_SCENE_MODE_SNOW },
{ SCENE_MODE_SUNSET, CAM_SCENE_MODE_SUNSET },
{ SCENE_MODE_STEADYPHOTO, CAM_SCENE_MODE_ANTISHAKE },
{ SCENE_MODE_FIREWORKS , CAM_SCENE_MODE_FIREWORKS },
{ SCENE_MODE_SPORTS , CAM_SCENE_MODE_SPORTS },
{ SCENE_MODE_PARTY, CAM_SCENE_MODE_PARTY },
{ SCENE_MODE_CANDLELIGHT, CAM_SCENE_MODE_CANDLELIGHT },
{ SCENE_MODE_ASD, CAM_SCENE_MODE_AUTO },
{ SCENE_MODE_BACKLIGHT, CAM_SCENE_MODE_BACKLIGHT },
{ SCENE_MODE_FLOWERS, CAM_SCENE_MODE_FLOWERS },
{ SCENE_MODE_AR, CAM_SCENE_MODE_AR },
{ SCENE_MODE_HDR, CAM_SCENE_MODE_HDR },
};
const QCameraParameters::QCameraMap<cam_flash_mode_t>
QCameraParameters::FLASH_MODES_MAP[] = {
{ FLASH_MODE_OFF, CAM_FLASH_MODE_OFF },
{ FLASH_MODE_AUTO, CAM_FLASH_MODE_AUTO },
{ FLASH_MODE_ON, CAM_FLASH_MODE_ON },
{ FLASH_MODE_TORCH, CAM_FLASH_MODE_TORCH }
};
const QCameraParameters::QCameraMap<cam_focus_algorithm_type>
QCameraParameters::FOCUS_ALGO_MAP[] = {
{ FOCUS_ALGO_AUTO, CAM_FOCUS_ALGO_AUTO },
{ FOCUS_ALGO_SPOT_METERING, CAM_FOCUS_ALGO_SPOT },
{ FOCUS_ALGO_CENTER_WEIGHTED, CAM_FOCUS_ALGO_CENTER_WEIGHTED },
{ FOCUS_ALGO_FRAME_AVERAGE, CAM_FOCUS_ALGO_AVERAGE }
};
const QCameraParameters::QCameraMap<cam_wb_mode_type>
QCameraParameters::WHITE_BALANCE_MODES_MAP[] = {
{ WHITE_BALANCE_AUTO, CAM_WB_MODE_AUTO },
{ WHITE_BALANCE_INCANDESCENT, CAM_WB_MODE_INCANDESCENT },
{ WHITE_BALANCE_FLUORESCENT, CAM_WB_MODE_FLUORESCENT },
{ WHITE_BALANCE_WARM_FLUORESCENT,CAM_WB_MODE_WARM_FLUORESCENT},
{ WHITE_BALANCE_DAYLIGHT, CAM_WB_MODE_DAYLIGHT },
{ WHITE_BALANCE_CLOUDY_DAYLIGHT, CAM_WB_MODE_CLOUDY_DAYLIGHT },
{ WHITE_BALANCE_TWILIGHT, CAM_WB_MODE_TWILIGHT },
{ WHITE_BALANCE_SHADE, CAM_WB_MODE_SHADE },
{ WHITE_BALANCE_MANUAL, CAM_WB_MODE_MANUAL},
};
const QCameraParameters::QCameraMap<cam_antibanding_mode_type>
QCameraParameters::ANTIBANDING_MODES_MAP[] = {
{ ANTIBANDING_OFF, CAM_ANTIBANDING_MODE_OFF },
{ ANTIBANDING_50HZ, CAM_ANTIBANDING_MODE_50HZ },
{ ANTIBANDING_60HZ, CAM_ANTIBANDING_MODE_60HZ },
{ ANTIBANDING_AUTO, CAM_ANTIBANDING_MODE_AUTO }
};
const QCameraParameters::QCameraMap<cam_iso_mode_type>
QCameraParameters::ISO_MODES_MAP[] = {
{ ISO_AUTO, CAM_ISO_MODE_AUTO },
{ ISO_HJR, CAM_ISO_MODE_DEBLUR },
{ ISO_100, CAM_ISO_MODE_100 },
{ ISO_200, CAM_ISO_MODE_200 },
{ ISO_400, CAM_ISO_MODE_400 },
{ ISO_800, CAM_ISO_MODE_800 },
{ ISO_1600, CAM_ISO_MODE_1600 },
{ ISO_3200, CAM_ISO_MODE_3200 }
};
const QCameraParameters::QCameraMap<cam_hfr_mode_t>
QCameraParameters::HFR_MODES_MAP[] = {
{ VIDEO_HFR_OFF, CAM_HFR_MODE_OFF },
{ VIDEO_HFR_2X, CAM_HFR_MODE_60FPS },
{ VIDEO_HFR_3X, CAM_HFR_MODE_90FPS },
{ VIDEO_HFR_4X, CAM_HFR_MODE_120FPS },
{ VIDEO_HFR_5X, CAM_HFR_MODE_150FPS },
{ VIDEO_HFR_6X, CAM_HFR_MODE_180FPS },
{ VIDEO_HFR_7X, CAM_HFR_MODE_210FPS },
{ VIDEO_HFR_8X, CAM_HFR_MODE_240FPS },
{ VIDEO_HFR_9X, CAM_HFR_MODE_480FPS }
};
const QCameraParameters::QCameraMap<cam_bracket_mode>
QCameraParameters::BRACKETING_MODES_MAP[] = {
{ AE_BRACKET_OFF, CAM_EXP_BRACKETING_OFF },
{ AE_BRACKET, CAM_EXP_BRACKETING_ON }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::ON_OFF_MODES_MAP[] = {
{ VALUE_OFF, 0 },
{ VALUE_ON, 1 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::TOUCH_AF_AEC_MODES_MAP[] = {
{ QCameraParameters::TOUCH_AF_AEC_OFF, 0 },
{ QCameraParameters::TOUCH_AF_AEC_ON, 1 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::ENABLE_DISABLE_MODES_MAP[] = {
{ VALUE_ENABLE, 1 },
{ VALUE_DISABLE, 0 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::DENOISE_ON_OFF_MODES_MAP[] = {
{ DENOISE_OFF, 0 },
{ DENOISE_ON, 1 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::TRUE_FALSE_MODES_MAP[] = {
{ VALUE_FALSE, 0},
{ VALUE_TRUE, 1}
};
const QCameraParameters::QCameraMap<cam_flip_t>
QCameraParameters::FLIP_MODES_MAP[] = {
{FLIP_MODE_OFF, FLIP_NONE},
{FLIP_MODE_V, FLIP_V},
{FLIP_MODE_H, FLIP_H},
{FLIP_MODE_VH, FLIP_V_H}
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::AF_BRACKETING_MODES_MAP[] = {
{ AF_BRACKET_OFF, 0 },
{ AF_BRACKET_ON, 1 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::RE_FOCUS_MODES_MAP[] = {
{ RE_FOCUS_OFF, 0 },
{ RE_FOCUS_ON, 1 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::CHROMA_FLASH_MODES_MAP[] = {
{ CHROMA_FLASH_OFF, 0 },
{ CHROMA_FLASH_ON, 1 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::OPTI_ZOOM_MODES_MAP[] = {
{ OPTI_ZOOM_OFF, 0 },
{ OPTI_ZOOM_ON, 1 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::TRUE_PORTRAIT_MODES_MAP[] = {
{ TRUE_PORTRAIT_OFF, 0 },
{ TRUE_PORTRAIT_ON, 1 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::STILL_MORE_MODES_MAP[] = {
{ STILL_MORE_OFF, 0 },
{ STILL_MORE_ON, 1 }
};
const QCameraParameters::QCameraMap<cam_cds_mode_type_t>
QCameraParameters::CDS_MODES_MAP[] = {
{ CDS_MODE_OFF, CAM_CDS_MODE_OFF },
{ CDS_MODE_ON, CAM_CDS_MODE_ON },
{ CDS_MODE_AUTO, CAM_CDS_MODE_AUTO}
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::HDR_MODES_MAP[] = {
{ HDR_MODE_SENSOR, 0 },
{ HDR_MODE_MULTI_FRAME, 1 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::VIDEO_ROTATION_MODES_MAP[] = {
{ VIDEO_ROTATION_0, 0 },
{ VIDEO_ROTATION_90, 90 },
{ VIDEO_ROTATION_180, 180 },
{ VIDEO_ROTATION_270, 270 }
};
const QCameraParameters::QCameraMap<int>
QCameraParameters::NOISE_REDUCTION_MODES_MAP[] = {
{ VALUE_OFF, 0 },
{ VALUE_FAST, 1 },
{ VALUE_HIGH_QUALITY, 2 }
};
#define DEFAULT_CAMERA_AREA "(0, 0, 0, 0, 0)"
#define DATA_PTR(MEM_OBJ,INDEX) MEM_OBJ->getPtr( INDEX )
#define TOTAL_RAM_SIZE_512MB 536870912
#define PARAM_MAP_SIZE(MAP) (sizeof(MAP)/sizeof(MAP[0]))
/*===========================================================================
* FUNCTION : isOEMFeat1PropEnabled
*
* DESCRIPTION: inline function to check from property if custom feature
* is enabled
*
* PARAMETERS : none
*
* RETURN : boolean true/false
*==========================================================================*/
static inline bool isOEMFeat1PropEnabled()
{
char value[PROPERTY_VALUE_MAX];
property_get("persist.camera.imglib.oemfeat1", value, "0");
return atoi(value) > 0 ? true : false;
}
/*===========================================================================
* FUNCTION : QCameraParameters
*
* DESCRIPTION: default constructor of QCameraParameters
*
* PARAMETERS : none
*
* RETURN : None
*==========================================================================*/
QCameraParameters::QCameraParameters()
: CameraParameters(),
m_reprocScaleParam(),
mCommon(),
m_pCapability(NULL),
m_pCamOpsTbl(NULL),
m_pParamHeap(NULL),
m_pParamBuf(NULL),
m_pRelCamSyncHeap(NULL),
m_pRelCamSyncBuf(NULL),
m_bFrameSyncEnabled(false),
mIsType(IS_TYPE_NONE),
mIsTypePreview(IS_TYPE_NONE),
m_bZslMode(false),
m_bZslMode_new(false),
m_bForceZslMode(false),
m_bRecordingHint(false),
m_bRecordingHint_new(false),
m_bHistogramEnabled(false),
m_bLongshotEnabled(false),
m_nFaceProcMask(0),
m_bFaceDetectionOn(0),
m_bDebugFps(false),
mFocusMode(CAM_FOCUS_MODE_MAX),
mPreviewFormat(CAM_FORMAT_YUV_420_NV21),
mAppPreviewFormat(CAM_FORMAT_YUV_420_NV21),
mPictureFormat(CAM_FORMAT_JPEG),
m_bNeedRestart(false),
m_bNoDisplayMode(false),
m_bWNROn(false),
m_bTNRPreviewOn(false),
m_bTNRVideoOn(false),
m_bTNRSnapshotOn(false),
m_bInited(false),
m_nRetroBurstNum(0),
m_nBurstLEDOnPeriod(100),
m_bUpdateEffects(false),
m_bSceneTransitionAuto(false),
m_bPreviewFlipChanged(false),
m_bVideoFlipChanged(false),
m_bSnapshotFlipChanged(false),
m_bFixedFrameRateSet(false),
m_bHDREnabled(false),
m_bLocalHDREnabled(false),
m_bAVTimerEnabled(false),
m_bDISEnabled(false),
m_MobiMask(0),
m_AdjustFPS(NULL),
m_bHDR1xFrameEnabled(false),
m_HDRSceneEnabled(false),
m_bHDRThumbnailProcessNeeded(false),
m_bHDR1xExtraBufferNeeded(true),
m_bHDROutputCropEnabled(false),
m_tempMap(),
m_bAFBracketingOn(false),
m_bReFocusOn(false),
m_bChromaFlashOn(false),
m_bOptiZoomOn(false),
m_bSceneSelection(false),
m_SelectedScene(CAM_SCENE_MODE_MAX),
m_bSeeMoreOn(false),
m_bStillMoreOn(false),
m_bHighQualityNoiseReductionMode(false),
m_bHfrMode(false),
m_bSensorHDREnabled(false),
m_bRdiMode(false),
m_bSecureMode(false),
m_bAeBracketingEnabled(false),
mFlashValue(CAM_FLASH_MODE_OFF),
mFlashDaemonValue(CAM_FLASH_MODE_OFF),
mHfrMode(CAM_HFR_MODE_OFF),
m_bHDRModeSensor(true),
mOfflineRAW(false),
m_bTruePortraitOn(false),
m_bIsLowMemoryDevice(false),
mCds_mode(CAM_CDS_MODE_OFF),
m_LLCaptureEnabled(FALSE),
m_LowLightLevel(CAM_LOW_LIGHT_OFF),
m_bLtmForSeeMoreEnabled(false),
m_expTime(0),
m_isoValue(0),
m_ManualCaptureMode(CAM_MANUAL_CAPTURE_TYPE_OFF),
m_dualLedCalibration(0),
m_bInstantAEC(false),
m_bInstantCapture(false),
mAecFrameBound(0),
mAecSkipDisplayFrameBound(0)
{
char value[PROPERTY_VALUE_MAX];
// TODO: may move to parameter instead of sysprop
property_get("persist.debug.sf.showfps", value, "0");
m_bDebugFps = atoi(value) > 0 ? true : false;
// For thermal mode, it should be set as system property
// because system property applies to all applications, while
// parameters only apply to specific app.
property_get("persist.camera.thermal.mode", value, "fps");
if (!strcmp(value, "frameskip")) {
m_ThermalMode = QCAMERA_THERMAL_ADJUST_FRAMESKIP;
} else {
if (strcmp(value, "fps"))
LOGW("Invalid camera thermal mode %s", value);
m_ThermalMode = QCAMERA_THERMAL_ADJUST_FPS;
}
memset(value, 0, sizeof(value));
// As per Power/Quality evaluation, LTM is enabled by default in SeeMore/StillMore usecase
// to improve the quality as there is no much impact to power
property_get("persist.camera.ltmforseemore", value, "1");
m_bLtmForSeeMoreEnabled = atoi(value);
memset(&m_LiveSnapshotSize, 0, sizeof(m_LiveSnapshotSize));
memset(&m_default_fps_range, 0, sizeof(m_default_fps_range));
memset(&m_hfrFpsRange, 0, sizeof(m_hfrFpsRange));
memset(&m_stillmore_config, 0, sizeof(cam_still_more_t));
memset(&m_captureFrameConfig, 0, sizeof(cam_capture_frame_config_t));
memset(&m_relCamSyncInfo, 0, sizeof(cam_sync_related_sensors_event_info_t));
mTotalPPCount = 1;
mZoomLevel = 0;
mParmZoomLevel = 0;
mCurPPCount = 0;
mBufBatchCnt = 0;
mRotation = 0;
mJpegRotation = 0;
mVideoBatchSize = 0;
m_bOEMFeatEnabled = isOEMFeat1PropEnabled();
}
/*===========================================================================
* FUNCTION : QCameraParameters
*
* DESCRIPTION: constructor of QCameraParameters
*
* PARAMETERS :
* @params : parameters in string
*
* RETURN : None
*==========================================================================*/
QCameraParameters::QCameraParameters(const String8 &params)
: CameraParameters(params),
m_reprocScaleParam(),
m_pCapability(NULL),
m_pCamOpsTbl(NULL),
m_pParamHeap(NULL),
m_pParamBuf(NULL),
m_pRelCamSyncHeap(NULL),
m_pRelCamSyncBuf(NULL),
m_bFrameSyncEnabled(false),
m_bZslMode(false),
m_bZslMode_new(false),
m_bForceZslMode(false),
m_bRecordingHint(false),
m_bRecordingHint_new(false),
m_bHistogramEnabled(false),
m_bLongshotEnabled(false),
m_nFaceProcMask(0),
m_bDebugFps(false),
mFocusMode(CAM_FOCUS_MODE_MAX),
mPreviewFormat(CAM_FORMAT_YUV_420_NV21),
mAppPreviewFormat(CAM_FORMAT_YUV_420_NV21),
mPictureFormat(CAM_FORMAT_JPEG),
m_bNeedRestart(false),
m_bNoDisplayMode(false),
m_bWNROn(false),
m_bTNRPreviewOn(false),
m_bTNRVideoOn(false),
m_bTNRSnapshotOn(false),
m_bInited(false),
m_nRetroBurstNum(0),
m_nBurstLEDOnPeriod(100),
m_bPreviewFlipChanged(false),
m_bVideoFlipChanged(false),
m_bSnapshotFlipChanged(false),
m_bFixedFrameRateSet(false),
m_bHDREnabled(false),
m_bLocalHDREnabled(false),
m_bAVTimerEnabled(false),
m_AdjustFPS(NULL),
m_bHDR1xFrameEnabled(false),
m_HDRSceneEnabled(false),
m_bHDRThumbnailProcessNeeded(false),
m_bHDR1xExtraBufferNeeded(true),
m_bHDROutputCropEnabled(false),
m_tempMap(),
m_bAFBracketingOn(false),
m_bReFocusOn(false),
m_bChromaFlashOn(false),
m_bOptiZoomOn(false),
m_bSceneSelection(false),
m_SelectedScene(CAM_SCENE_MODE_MAX),
m_bSeeMoreOn(false),
m_bStillMoreOn(false),
m_bHighQualityNoiseReductionMode(false),
m_bHfrMode(false),
m_bSensorHDREnabled(false),
m_bRdiMode(false),
m_bSecureMode(false),
m_bAeBracketingEnabled(false),
mFlashValue(CAM_FLASH_MODE_OFF),
mFlashDaemonValue(CAM_FLASH_MODE_OFF),
mHfrMode(CAM_HFR_MODE_OFF),
m_bHDRModeSensor(true),
mOfflineRAW(false),
m_bTruePortraitOn(false),
m_bIsLowMemoryDevice(false),
mCds_mode(CAM_CDS_MODE_OFF),
mParmEffect(CAM_EFFECT_MODE_OFF),
m_LLCaptureEnabled(FALSE),
m_LowLightLevel(CAM_LOW_LIGHT_OFF),
m_bLtmForSeeMoreEnabled(false),
m_expTime(0),
m_isoValue(0),
m_ManualCaptureMode(CAM_MANUAL_CAPTURE_TYPE_OFF),
m_dualLedCalibration(0),
m_bInstantAEC(false),
m_bInstantCapture(false),
mAecFrameBound(0),
mAecSkipDisplayFrameBound(0)
{
memset(&m_LiveSnapshotSize, 0, sizeof(m_LiveSnapshotSize));
memset(&m_default_fps_range, 0, sizeof(m_default_fps_range));
memset(&m_hfrFpsRange, 0, sizeof(m_hfrFpsRange));
memset(&m_stillmore_config, 0, sizeof(cam_still_more_t));
memset(&m_relCamSyncInfo, 0, sizeof(cam_sync_related_sensors_event_info_t));
mTotalPPCount = 0;
mZoomLevel = 0;
mParmZoomLevel = 0;
mCurPPCount = 0;
mRotation = 0;
mJpegRotation = 0;
mBufBatchCnt = 0;
mVideoBatchSize = 0;
m_bOEMFeatEnabled = isOEMFeat1PropEnabled();
}
/*===========================================================================
* FUNCTION : ~QCameraParameters
*
* DESCRIPTION: deconstructor of QCameraParameters
*
* PARAMETERS : none
*
* RETURN : None
*==========================================================================*/
QCameraParameters::~QCameraParameters()
{
deinit();
}
/*===========================================================================
* FUNCTION : createSizesString
*
* DESCRIPTION: create string obj contains array of dimensions
*
* PARAMETERS :
* @sizes : array of dimensions
* @len : size of dimension array
*
* RETURN : string obj
*==========================================================================*/
String8 QCameraParameters::createSizesString(const cam_dimension_t *sizes, size_t len)
{
String8 str;
char buffer[32];
if (len > 0) {
snprintf(buffer, sizeof(buffer), "%dx%d", sizes[0].width, sizes[0].height);
str.append(buffer);
}
for (size_t i = 1; i < len; i++) {
snprintf(buffer, sizeof(buffer), ",%dx%d",
sizes[i].width, sizes[i].height);
str.append(buffer);
}
return str;
}
/*===========================================================================
* FUNCTION : createValuesString
*
* DESCRIPTION: create string obj contains array of values from map when matched
* from input values array
*
* PARAMETERS :
* @values : array of values
* @len : size of values array
* @map : map contains the mapping between values and enums
* @map_len : size of the map
*
* RETURN : string obj
*==========================================================================*/
template <typename valuesType, class mapType> String8 createValuesString(
const valuesType *values, size_t len, const mapType *map, size_t map_len)
{
String8 str;
int count = 0;
for (size_t i = 0; i < len; i++ ) {
for (size_t j = 0; j < map_len; j ++)
if (map[j].val == values[i]) {
if (NULL != map[j].desc) {
if (count > 0) {
str.append(",");
}
str.append(map[j].desc);
count++;
break; //loop j
}
}
}
return str;
}
/*===========================================================================
* FUNCTION : createValuesStringFromMap
*
* DESCRIPTION: create string obj contains array of values directly from map
*
* PARAMETERS :
* @map : map contains the mapping between values and enums
* @map_len : size of the map
*
* RETURN : string obj
*==========================================================================*/
template <class mapType> String8 createValuesStringFromMap(
const mapType *map, size_t map_len)
{
String8 str;
for (size_t i = 0; i < map_len; i++) {
if (NULL != map[i].desc) {
if (i > 0) {
str.append(",");
}
str.append(map[i].desc);
}
}
return str;
}
/*===========================================================================
* FUNCTION : createZoomRatioValuesString
*
* DESCRIPTION: create string obj contains array of zoom ratio values
*
* PARAMETERS :
* @zoomRaios : array of zoom ratios
* @length : size of the array
*
* RETURN : string obj
*==========================================================================*/
String8 QCameraParameters::createZoomRatioValuesString(uint32_t *zoomRatios,
size_t length)
{
String8 str;
char buffer[32] = {0};
if(length > 0){
snprintf(buffer, sizeof(buffer), "%d", zoomRatios[0]);
str.append(buffer);
}
for (size_t i = 1; i < length; i++) {
memset(buffer, 0, sizeof(buffer));
snprintf(buffer, sizeof(buffer), ",%d", zoomRatios[i]);
str.append(buffer);
}
return str;
}
/*===========================================================================
* FUNCTION : createHfrValuesString
*
* DESCRIPTION: create string obj contains array of hfr values from map when
* matched from input hfr values
*
* PARAMETERS :
* @values : array of hfr info
* @len : size of the array
* @map : map of hfr string value and enum
* map_len : size of map
*
* RETURN : string obj
*==========================================================================*/
String8 QCameraParameters::createHfrValuesString(const cam_hfr_info_t *values,
size_t len, const QCameraMap<cam_hfr_mode_t> *map, size_t map_len)
{
String8 str;
int count = 0;
//Create HFR supported size string.
for (size_t i = 0; i < len; i++ ) {
for (size_t j = 0; j < map_len; j ++) {
if (map[j].val == (int)values[i].mode) {
if (NULL != map[j].desc) {
if (count > 0) {
str.append(",");
}
str.append(map[j].desc);
count++;
break; //loop j
}
}
}
}
if (count > 0) {
str.append(",");
}
str.append(VIDEO_HFR_OFF);
return str;
}
/*===========================================================================
* FUNCTION : createHfrSizesString
*
* DESCRIPTION: create string obj contains array of hfr sizes
*
* PARAMETERS :
* @values : array of hfr info
* @len : size of the array
*
* RETURN : string obj
*==========================================================================*/
String8 QCameraParameters::createHfrSizesString(const cam_hfr_info_t *values, size_t len)
{
String8 str;
char buffer[32];
if (len > 0) {
snprintf(buffer, sizeof(buffer), "%dx%d",
values[0].dim[0].width, values[0].dim[0].height);
str.append(buffer);
}
for (size_t i = 1; i < len; i++) {
snprintf(buffer, sizeof(buffer), ",%dx%d",
values[i].dim[0].width, values[i].dim[0].height);
str.append(buffer);
}
return str;
}
/*===========================================================================
* FUNCTION : createFpsString
*
* DESCRIPTION: create string obj contains array of FPS rates
*
* PARAMETERS :
* @fps : default fps range
*
* RETURN : string obj
*==========================================================================*/
String8 QCameraParameters::createFpsString(cam_fps_range_t &fps)
{
char buffer[32];
String8 fpsValues;
int min_fps = int(fps.min_fps);
int max_fps = int(fps.max_fps);
if (min_fps < fps.min_fps){
min_fps++;
}
if (max_fps > fps.max_fps) {
max_fps--;
}
if (min_fps <= max_fps) {
snprintf(buffer, sizeof(buffer), "%d", min_fps);
fpsValues.append(buffer);
}
for (int i = min_fps+1; i <= max_fps; i++) {
snprintf(buffer, sizeof(buffer), ",%d", i);
fpsValues.append(buffer);
}
return fpsValues;
}
/*===========================================================================
* FUNCTION : createFpsRangeString
*
* DESCRIPTION: create string obj contains array of FPS ranges
*
* PARAMETERS :
* @fps : array of fps ranges
* @len : size of the array
* @default_fps_index : reference to index of default fps range
*
* RETURN : string obj
*==========================================================================*/
String8 QCameraParameters::createFpsRangeString(const cam_fps_range_t* fps,
size_t len, int &default_fps_index)
{
String8 str;
char buffer[32];
int max_range = 0;
int min_fps, max_fps;
if (len > 0) {
min_fps = int(fps[0].min_fps * 1000);
max_fps = int(fps[0].max_fps * 1000);
max_range = max_fps - min_fps;
default_fps_index = 0;
snprintf(buffer, sizeof(buffer), "(%d,%d)", min_fps, max_fps);
str.append(buffer);
}
for (size_t i = 1; i < len; i++) {
min_fps = int(fps[i].min_fps * 1000);
max_fps = int(fps[i].max_fps * 1000);
if (max_range < (max_fps - min_fps)) {
max_range = max_fps - min_fps;
default_fps_index = (int)i;
}
snprintf(buffer, sizeof(buffer), ",(%d,%d)", min_fps, max_fps);
str.append(buffer);
}
return str;
}
/*===========================================================================
* FUNCTION : lookupAttr
*
* DESCRIPTION: lookup a value by its name
*
* PARAMETERS :
* @attr : map contains <name, value>
* @len : size of the map
* @name : name to be looked up
*
* RETURN : valid value if found
* NAME_NOT_FOUND if not found
*==========================================================================*/
template <class mapType> int lookupAttr(const mapType *arr,
size_t len, const char *name)
{
if (name) {
for (size_t i = 0; i < len; i++) {
if (!strcmp(arr[i].desc, name))
return arr[i].val;
}
}
return NAME_NOT_FOUND;
}
/*===========================================================================
* FUNCTION : lookupNameByValue
*
* DESCRIPTION: lookup a name by its value
*
* PARAMETERS :
* @attr : map contains <name, value>
* @len : size of the map
* @value : value to be looked up
*
* RETURN : name str or NULL if not found
*==========================================================================*/
template <class mapType> const char *lookupNameByValue(const mapType *arr,
size_t len, int value)
{
for (size_t i = 0; i < len; i++) {
if (arr[i].val == value) {
return arr[i].desc;
}
}
return NULL;
}
/*===========================================================================
* FUNCTION : setPreviewSize
*
* DESCRIPTION: set preview size from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setPreviewSize(const QCameraParameters& params)
{
int width = 0, height = 0;
int old_width = 0, old_height = 0;
params.getPreviewSize(&width, &height);
CameraParameters::getPreviewSize(&old_width, &old_height);
// Validate the preview size
for (size_t i = 0; i < m_pCapability->preview_sizes_tbl_cnt; ++i) {
if (width == m_pCapability->preview_sizes_tbl[i].width
&& height == m_pCapability->preview_sizes_tbl[i].height) {
// check if need to restart preview in case of preview size change
if (width != old_width || height != old_height) {
LOGI("Requested preview size %d x %d", width, height);
m_bNeedRestart = true;
}
// set the new value
CameraParameters::setPreviewSize(width, height);
return NO_ERROR;
}
}
if (m_relCamSyncInfo.mode == CAM_MODE_SECONDARY) {
char prop[PROPERTY_VALUE_MAX];
// set prop to configure aux preview size
property_get("persist.camera.aux.preview.size", prop, "0");
parse_pair(prop, &width, &height, 'x', NULL);
bool foundMatch = false;
for (size_t i = 0; i < m_pCapability->preview_sizes_tbl_cnt; ++i) {
if (width == m_pCapability->preview_sizes_tbl[i].width &&
height == m_pCapability->preview_sizes_tbl[i].height) {
foundMatch = true;
}
}
if (!foundMatch) {
width = m_pCapability->preview_sizes_tbl[0].width;
height = m_pCapability->preview_sizes_tbl[0].height;
}
// check if need to restart preview in case of preview size change
if (width != old_width || height != old_height) {
m_bNeedRestart = true;
}
CameraParameters::setPreviewSize(width, height);
LOGH("Secondary Camera: preview size %d x %d", width, height);
return NO_ERROR;
}
LOGE("Invalid preview size requested: %dx%d", width, height);
return BAD_VALUE;
}
/*===========================================================================
* FUNCTION : setPictureSize
*
* DESCRIPTION: set picture size from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setPictureSize(const QCameraParameters& params)
{
int width, height;
params.getPictureSize(&width, &height);
int old_width, old_height;
CameraParameters::getPictureSize(&old_width, &old_height);
// Validate the picture size
if(!m_reprocScaleParam.isScaleEnabled()){
for (size_t i = 0; i < m_pCapability->picture_sizes_tbl_cnt; ++i) {
if (width == m_pCapability->picture_sizes_tbl[i].width
&& height == m_pCapability->picture_sizes_tbl[i].height) {
// check if need to restart preview in case of picture size change
if ((m_bZslMode || m_bRecordingHint) &&
(width != old_width || height != old_height)) {
LOGI("Requested picture size %d x %d", width, height);
m_bNeedRestart = true;
}
// set the new value
CameraParameters::setPictureSize(width, height);
// Update View angles based on Picture Aspect ratio
updateViewAngles();
return NO_ERROR;
}
}
}else{
//should use scaled picture size table to validate
if(m_reprocScaleParam.setValidatePicSize(width, height) == NO_ERROR){
// check if need to restart preview in case of picture size change
if ((m_bZslMode || m_bRecordingHint) &&
(width != old_width || height != old_height)) {
m_bNeedRestart = true;
}
// set the new value
char val[32];
snprintf(val, sizeof(val), "%dx%d", width, height);
updateParamEntry(KEY_PICTURE_SIZE, val);
LOGH("%s", val);
// Update View angles based on Picture Aspect ratio
updateViewAngles();
return NO_ERROR;
}
}
if (m_relCamSyncInfo.mode == CAM_MODE_SECONDARY) {
char prop[PROPERTY_VALUE_MAX];
// set prop to configure aux preview size
property_get("persist.camera.aux.picture.size", prop, "0");
parse_pair(prop, &width, &height, 'x', NULL);
bool foundMatch = false;
for (size_t i = 0; i < m_pCapability->picture_sizes_tbl_cnt; ++i) {
if (width == m_pCapability->picture_sizes_tbl[i].width &&
height == m_pCapability->picture_sizes_tbl[i].height) {
foundMatch = true;
}
}
if (!foundMatch) {
width = m_pCapability->picture_sizes_tbl[0].width;
height = m_pCapability->picture_sizes_tbl[0].height;
}
// check if need to restart preview in case of preview size change
if (width != old_width || height != old_height) {
m_bNeedRestart = true;
}
char val[32];
snprintf(val, sizeof(val), "%dx%d", width, height);
set(KEY_PICTURE_SIZE, val);
LOGH("Secondary Camera: picture size %s", val);
return NO_ERROR;
}
LOGE("Invalid picture size requested: %dx%d", width, height);
return BAD_VALUE;
}
/*===========================================================================
* FUNCTION : updateViewAngles
*
* DESCRIPTION: Update the Horizontal & Vertical based on the Aspect ratio of Preview and
* Picture aspect ratio
*
* PARAMETERS : none
*
* RETURN : none
*==========================================================================*/
void QCameraParameters::updateViewAngles()
{
double stillAspectRatio, maxPictureAspectRatio;
int stillWidth, stillHeight, maxWidth, maxHeight;
// The crop factors from the full sensor array to the still picture crop region
double horizCropFactor = 1.f,vertCropFactor = 1.f;
float horizViewAngle, vertViewAngle, maxHfov, maxVfov;
// Get current Picture & max Snapshot sizes
getPictureSize(&stillWidth, &stillHeight);
maxWidth = m_pCapability->picture_sizes_tbl[0].width;
maxHeight = m_pCapability->picture_sizes_tbl[0].height;
// Get default maximum FOV from corresponding sensor driver
maxHfov = m_pCapability->hor_view_angle;
maxVfov = m_pCapability->ver_view_angle;
stillAspectRatio = (double)stillWidth/stillHeight;
maxPictureAspectRatio = (double)maxWidth/maxHeight;
LOGD("Stillwidth: %d, height: %d", stillWidth, stillHeight);
LOGD("Max width: %d, height: %d", maxWidth, maxHeight);
LOGD("still aspect: %f, Max Pic Aspect: %f",
stillAspectRatio, maxPictureAspectRatio);
// crop as per the Maximum Snapshot aspect ratio
if (stillAspectRatio < maxPictureAspectRatio)
horizCropFactor = stillAspectRatio/maxPictureAspectRatio;
else
vertCropFactor = maxPictureAspectRatio/stillAspectRatio;
LOGD("horizCropFactor %f, vertCropFactor %f",
horizCropFactor, vertCropFactor);
// Now derive the final FOV's based on field of view formula is i.e,
// angle of view = 2 * arctangent ( d / 2f )
// where d is the physical sensor dimension of interest, and f is
// the focal length. This only applies to rectilinear sensors, for focusing
// at distances >> f, etc.
// Here d/2f is nothing but the Maximum Horizontal or Veritical FOV
horizViewAngle = (180/PI)*2*atan(horizCropFactor*tan((maxHfov/2)*(PI/180)));
vertViewAngle = (180/PI)*2*atan(horizCropFactor*tan((maxVfov/2)*(PI/180)));
setFloat(QCameraParameters::KEY_HORIZONTAL_VIEW_ANGLE, horizViewAngle);
setFloat(QCameraParameters::KEY_VERTICAL_VIEW_ANGLE, vertViewAngle);
LOGH("Final horizViewAngle %f, vertViewAngle %f",
horizViewAngle, vertViewAngle);
}
/*===========================================================================
* FUNCTION : setVideoSize
*
* DESCRIPTION: set video size from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setVideoSize(const QCameraParameters& params)
{
const char *str= NULL;
int width, height;
str = params.get(KEY_VIDEO_SIZE);
int old_width, old_height;
CameraParameters::getVideoSize(&old_width, &old_height);
if(!str) {
//If application didn't set this parameter string, use the values from
//getPreviewSize() as video dimensions.
params.getPreviewSize(&width, &height);
LOGW("No Record Size requested, use the preview dimensions");
} else {
params.getVideoSize(&width, &height);
}
// Validate the video size
for (size_t i = 0; i < m_pCapability->video_sizes_tbl_cnt; ++i) {
if (width == m_pCapability->video_sizes_tbl[i].width
&& height == m_pCapability->video_sizes_tbl[i].height) {
// check if need to restart preview in case of video size change
if (m_bRecordingHint &&
(width != old_width || height != old_height)) {
m_bNeedRestart = true;
}
// set the new value
LOGH("Requested video size %d x %d", width, height);
CameraParameters::setVideoSize(width, height);
return NO_ERROR;
}
}
if (m_relCamSyncInfo.mode == CAM_MODE_SECONDARY) {
// Set the default preview size for secondary camera
width = m_pCapability->video_sizes_tbl[0].width;
height = m_pCapability->video_sizes_tbl[0].height;
// check if need to restart preview in case of preview size change
if (width != old_width || height != old_height) {
m_bNeedRestart = true;
}
CameraParameters::setVideoSize(width, height);
LOGH("Secondary Camera: video size %d x %d",
width, height);
return NO_ERROR;
}
LOGE("Error !! Invalid video size requested: %dx%d", width, height);
return BAD_VALUE;
}
/*===========================================================================
* FUNCTION : getLiveSnapshotSize
*
* DESCRIPTION: get live snapshot size
*
* PARAMETERS : dim - Update dim with the liveshot size
*
*==========================================================================*/
void QCameraParameters::getLiveSnapshotSize(cam_dimension_t &dim)
{
if(is4k2kVideoResolution()) {
// We support maximum 8M liveshot @4K2K video resolution
cam_dimension_t resolution = {0, 0};
CameraParameters::getVideoSize(&resolution.width, &resolution.height);
if((m_LiveSnapshotSize.width > resolution.width) ||
(m_LiveSnapshotSize.height > resolution.height)) {
m_LiveSnapshotSize.width = resolution.width;
m_LiveSnapshotSize.height = resolution.height;
}
}
dim = m_LiveSnapshotSize;
LOGH("w x h: %d x %d", dim.width, dim.height);
}
/*===========================================================================
* FUNCTION : setLiveSnapshotSize
*
* DESCRIPTION: set live snapshot size
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setLiveSnapshotSize(const QCameraParameters& params)
{
char value[PROPERTY_VALUE_MAX];
property_get("persist.camera.opt.livepic", value, "1");
bool useOptimal = atoi(value) > 0 ? true : false;
bool vHdrOn;
int32_t liveSnapWidth = 0, liveSnapHeight = 0;
// use picture size from user setting
params.getPictureSize(&m_LiveSnapshotSize.width, &m_LiveSnapshotSize.height);
size_t livesnapshot_sizes_tbl_cnt =
m_pCapability->livesnapshot_sizes_tbl_cnt;
cam_dimension_t *livesnapshot_sizes_tbl =
&m_pCapability->livesnapshot_sizes_tbl[0];
if(is4k2kVideoResolution()) {
// We support maximum 8M liveshot @4K2K video resolution
cam_dimension_t resolution = {0, 0};
CameraParameters::getVideoSize(&resolution.width, &resolution.height);
if((m_LiveSnapshotSize.width > resolution.width) ||
(m_LiveSnapshotSize.height > resolution.height)) {
m_LiveSnapshotSize.width = resolution.width;
m_LiveSnapshotSize.height = resolution.height;
}
}
// check if HFR is enabled
const char *hfrStr = params.get(KEY_QC_VIDEO_HIGH_FRAME_RATE);
cam_hfr_mode_t hfrMode = CAM_HFR_MODE_OFF;
const char *hsrStr = params.get(KEY_QC_VIDEO_HIGH_SPEED_RECORDING);
const char *vhdrStr = params.get(KEY_QC_VIDEO_HDR);
vHdrOn = (vhdrStr != NULL && (0 == strcmp(vhdrStr,"on"))) ? true : false;
if (vHdrOn) {
livesnapshot_sizes_tbl_cnt = m_pCapability->vhdr_livesnapshot_sizes_tbl_cnt;
livesnapshot_sizes_tbl = &m_pCapability->vhdr_livesnapshot_sizes_tbl[0];
}
if ((hsrStr != NULL) && strcmp(hsrStr, "off")) {
int32_t hsr = lookupAttr(HFR_MODES_MAP, PARAM_MAP_SIZE(HFR_MODES_MAP), hsrStr);
if ((hsr != NAME_NOT_FOUND) && (hsr > CAM_HFR_MODE_OFF)) {
// if HSR is enabled, change live snapshot size
for (size_t i = 0; i < m_pCapability->hfr_tbl_cnt; i++) {
if (m_pCapability->hfr_tbl[i].mode == hsr) {
livesnapshot_sizes_tbl_cnt =
m_pCapability->hfr_tbl[i].livesnapshot_sizes_tbl_cnt;
livesnapshot_sizes_tbl =
&m_pCapability->hfr_tbl[i].livesnapshot_sizes_tbl[0];
hfrMode = m_pCapability->hfr_tbl[i].mode;
break;
}
}
}
} else if ((hfrStr != NULL) && strcmp(hfrStr, "off")) {
int32_t hfr = lookupAttr(HFR_MODES_MAP, PARAM_MAP_SIZE(HFR_MODES_MAP), hfrStr);
if ((hfr != NAME_NOT_FOUND) && (hfr > CAM_HFR_MODE_OFF)) {
// if HFR is enabled, change live snapshot size
for (size_t i = 0; i < m_pCapability->hfr_tbl_cnt; i++) {
if (m_pCapability->hfr_tbl[i].mode == hfr) {
livesnapshot_sizes_tbl_cnt =
m_pCapability->hfr_tbl[i].livesnapshot_sizes_tbl_cnt;
livesnapshot_sizes_tbl =
&m_pCapability->hfr_tbl[i].livesnapshot_sizes_tbl[0];
hfrMode = m_pCapability->hfr_tbl[i].mode;
break;
}
}
}
}
if (useOptimal || hfrMode != CAM_HFR_MODE_OFF || vHdrOn) {
bool found = false;
// first check if picture size is within the list of supported sizes
for (size_t i = 0; i < livesnapshot_sizes_tbl_cnt; ++i) {
if (m_LiveSnapshotSize.width == livesnapshot_sizes_tbl[i].width &&
m_LiveSnapshotSize.height == livesnapshot_sizes_tbl[i].height) {
found = true;
break;
}
}
if (!found) {
// use optimal live snapshot size from supported list,
// that has same preview aspect ratio
int width = 0, height = 0;
params.getPreviewSize(&width, &height);
double previewAspectRatio = (double)width / height;
for (size_t i = 0; i < livesnapshot_sizes_tbl_cnt; ++i) {
double ratio = (double)livesnapshot_sizes_tbl[i].width /
livesnapshot_sizes_tbl[i].height;
if (fabs(previewAspectRatio - ratio) <= ASPECT_TOLERANCE) {
m_LiveSnapshotSize = livesnapshot_sizes_tbl[i];
found = true;
break;
}
}
if (!found && ((hfrMode != CAM_HFR_MODE_OFF) || vHdrOn)) {
// Cannot find matching aspect ration from supported live snapshot list
// choose the max dim from preview and video size
LOGD("Cannot find matching aspect ratio, choose max of preview or video size");
params.getVideoSize(&m_LiveSnapshotSize.width, &m_LiveSnapshotSize.height);
if (m_LiveSnapshotSize.width < width && m_LiveSnapshotSize.height < height) {
m_LiveSnapshotSize.width = width;
m_LiveSnapshotSize.height = height;
}
}
}
}
//To read liveshot resolution from setprop instead of matching aspect ratio.
//The setprop resolution format should be WxH.
//e.g: adb shell setprop persist.camera.liveshot.size 1280x720
memset(value, 0, PROPERTY_VALUE_MAX);
property_get("persist.camera.liveshot.size", value, "");
if (strlen(value) > 0) {
char *saveptr = NULL;
char *token = strtok_r(value, "x", &saveptr);
if (token != NULL) {
liveSnapWidth = atoi(token);
}
token = strtok_r(NULL, "x", &saveptr);
if (token != NULL) {
liveSnapHeight = atoi(token);
}
if ((liveSnapWidth!=0) && (liveSnapHeight!=0)) {
for (size_t i = 0; i < m_pCapability->picture_sizes_tbl_cnt; ++i) {
if (liveSnapWidth == m_pCapability->picture_sizes_tbl[i].width
&& liveSnapHeight == m_pCapability->picture_sizes_tbl[i].height) {
m_LiveSnapshotSize.width = liveSnapWidth;
m_LiveSnapshotSize.height = liveSnapHeight;
break;
}
}
}
}
LOGH("live snapshot size %d x %d",
m_LiveSnapshotSize.width, m_LiveSnapshotSize.height);
return NO_ERROR;
}
/*===========================================================================
* FUNCTION : setRawSize
*
* DESCRIPTION: set live snapshot size
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setRawSize(cam_dimension_t &dim)
{
m_rawSize = dim;
return NO_ERROR;
}
/*===========================================================================
* FUNCTION : setPreviewFormat
*
* DESCRIPTION: set preview format from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setPreviewFormat(const QCameraParameters& params)
{
const char *str = params.getPreviewFormat();
int32_t previewFormat = lookupAttr(PREVIEW_FORMATS_MAP,
PARAM_MAP_SIZE(PREVIEW_FORMATS_MAP), str);
if (previewFormat != NAME_NOT_FOUND) {
if (isUBWCEnabled()) {
char prop[PROPERTY_VALUE_MAX];
int pFormat;
memset(prop, 0, sizeof(prop));
property_get("persist.camera.preview.ubwc", prop, "1");
pFormat = atoi(prop);
if (pFormat == 1) {
mPreviewFormat = CAM_FORMAT_YUV_420_NV12_UBWC;
mAppPreviewFormat = (cam_format_t)previewFormat;
} else {
mPreviewFormat = (cam_format_t)previewFormat;
mAppPreviewFormat = (cam_format_t)previewFormat;
}
} else {
mPreviewFormat = (cam_format_t)previewFormat;
mAppPreviewFormat = (cam_format_t)previewFormat;
}
CameraParameters::setPreviewFormat(str);
LOGH("format %d\n", mPreviewFormat);
return NO_ERROR;
}
LOGE("Invalid preview format value: %s", (str == NULL) ? "NULL" : str);
return BAD_VALUE;
}
/*===========================================================================
* FUNCTION : setPictureFormat
*
* DESCRIPTION: set picture format from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setPictureFormat(const QCameraParameters& params)
{
const char *str = params.getPictureFormat();
int32_t pictureFormat = lookupAttr(PICTURE_TYPES_MAP, PARAM_MAP_SIZE(PICTURE_TYPES_MAP), str);
if (pictureFormat != NAME_NOT_FOUND) {
mPictureFormat = pictureFormat;
CameraParameters::setPictureFormat(str);
LOGH("format %d\n", mPictureFormat);
return NO_ERROR;
}
LOGE("Invalid picture format value: %s", (str == NULL) ? "NULL" : str);
return BAD_VALUE;
}
/*===========================================================================
* FUNCTION : setJpegThumbnailSize
*
* DESCRIPTION: set jpeg thumbnail size from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setJpegThumbnailSize(const QCameraParameters& params)
{
int width = params.getInt(KEY_JPEG_THUMBNAIL_WIDTH);
int height = params.getInt(KEY_JPEG_THUMBNAIL_HEIGHT);
LOGD("requested jpeg thumbnail size %d x %d", width, height);
int sizes_cnt = sizeof(THUMBNAIL_SIZES_MAP) / sizeof(cam_dimension_t);
// Validate thumbnail size
for (int i = 0; i < sizes_cnt; i++) {
if (width == THUMBNAIL_SIZES_MAP[i].width &&
height == THUMBNAIL_SIZES_MAP[i].height) {
set(KEY_JPEG_THUMBNAIL_WIDTH, width);
set(KEY_JPEG_THUMBNAIL_HEIGHT, height);
return NO_ERROR;
}
}
LOGE("error: setting jpeg thumbnail size (%d, %d)", width, height);
return BAD_VALUE;
}
/*===========================================================================
* FUNCTION : setBurstLEDOnPeriod
*
* DESCRIPTION: set burst LED on period
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setBurstLEDOnPeriod(const QCameraParameters& params)
{
int nBurstLEDOnPeriod = params.getInt(KEY_QC_SNAPSHOT_BURST_LED_ON_PERIOD);
//Check if the LED ON period is within limits
if ((nBurstLEDOnPeriod <= 0) || (nBurstLEDOnPeriod > 800)) {
// if burst led on period is not set in parameters,
// read from sys prop
char prop[PROPERTY_VALUE_MAX];
memset(prop, 0, sizeof(prop));
property_get("persist.camera.led.on.period", prop, "0");
nBurstLEDOnPeriod = atoi(prop);
if (nBurstLEDOnPeriod <= 0) {
nBurstLEDOnPeriod = 300;
}
}
set(KEY_QC_SNAPSHOT_BURST_LED_ON_PERIOD, nBurstLEDOnPeriod);
m_nBurstLEDOnPeriod = nBurstLEDOnPeriod;
LOGH("Burst LED on period %u", m_nBurstLEDOnPeriod);
if (ADD_SET_PARAM_ENTRY_TO_BATCH(m_pParamBuf, CAM_INTF_PARM_BURST_LED_ON_PERIOD,
(uint32_t)nBurstLEDOnPeriod)) {
return BAD_VALUE;
}
return NO_ERROR;
}
/*===========================================================================
* FUNCTION : setRetroActiveBurstNum
*
* DESCRIPTION: set retro active burst num
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setRetroActiveBurstNum(
const QCameraParameters& params)
{
int32_t nBurstNum = params.getInt(KEY_QC_NUM_RETRO_BURST_PER_SHUTTER);
LOGH("m_nRetroBurstNum = %d", m_nRetroBurstNum);
if (nBurstNum <= 0) {
// if burst number is not set in parameters,
// read from sys prop
char prop[PROPERTY_VALUE_MAX];
memset(prop, 0, sizeof(prop));
property_get("persist.camera.retro.number", prop, "0");
nBurstNum = atoi(prop);
if (nBurstNum < 0) {
nBurstNum = 0;
}
}
set(KEY_QC_NUM_RETRO_BURST_PER_SHUTTER, nBurstNum);
m_nRetroBurstNum = nBurstNum;
LOGH("m_nRetroBurstNum = %d", m_nRetroBurstNum);
return NO_ERROR;
}
/*===========================================================================
* FUNCTION : setJpegQuality
*
* DESCRIPTION: set jpeg encpding quality from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setJpegQuality(const QCameraParameters& params)
{
int32_t rc = NO_ERROR;
int quality = params.getInt(KEY_JPEG_QUALITY);
if (quality >= 0 && quality <= 100) {
set(KEY_JPEG_QUALITY, quality);
} else {
LOGE("Invalid jpeg quality=%d", quality);
rc = BAD_VALUE;
}
quality = params.getInt(KEY_JPEG_THUMBNAIL_QUALITY);
if (quality >= 0 && quality <= 100) {
set(KEY_JPEG_THUMBNAIL_QUALITY, quality);
} else {
LOGE("Invalid jpeg thumbnail quality=%d", quality);
rc = BAD_VALUE;
}
return rc;
}
/*===========================================================================
* FUNCTION : setOrientaion
*
* DESCRIPTION: set orientaion from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setOrientation(const QCameraParameters& params)
{
const char *str = params.get(KEY_QC_ORIENTATION);
if (str != NULL) {
if (strcmp(str, portrait) == 0 || strcmp(str, landscape) == 0) {
// Camera service needs this to decide if the preview frames and raw
// pictures should be rotated.
set(KEY_QC_ORIENTATION, str);
} else {
LOGE("Invalid orientation value: %s", str);
return BAD_VALUE;
}
}
return NO_ERROR;
}
/*===========================================================================
* FUNCTION : setAutoExposure
*
* DESCRIPTION: set auto exposure value from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setAutoExposure(const QCameraParameters& params)
{
const char *str = params.get(KEY_QC_AUTO_EXPOSURE);
const char *prev_str = get(KEY_QC_AUTO_EXPOSURE);
if (str != NULL) {
if (prev_str == NULL ||
strcmp(str, prev_str) != 0) {
return setAutoExposure(str);
}
}
return NO_ERROR;
}
/*===========================================================================
* FUNCTION : setPreviewFpsRange
*
* DESCRIPTION: set preview FPS range from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setPreviewFpsRange(const QCameraParameters& params)
{
int minFps,maxFps;
int prevMinFps, prevMaxFps, vidMinFps, vidMaxFps;
int rc = NO_ERROR;
bool found = false, updateNeeded = false;
CameraParameters::getPreviewFpsRange(&prevMinFps, &prevMaxFps);
params.getPreviewFpsRange(&minFps, &maxFps);
LOGH("FpsRange Values:(%d, %d)", prevMinFps, prevMaxFps);
LOGH("Requested FpsRange Values:(%d, %d)", minFps, maxFps);
//first check if we need to change fps because of HFR mode change
updateNeeded = UpdateHFRFrameRate(params);
if (updateNeeded) {
m_bNeedRestart = true;
rc = setHighFrameRate(mHfrMode);
if (rc != NO_ERROR) goto end;
}
LOGH("UpdateHFRFrameRate %d", updateNeeded);
vidMinFps = (int)m_hfrFpsRange.video_min_fps;
vidMaxFps = (int)m_hfrFpsRange.video_max_fps;
if(minFps == prevMinFps && maxFps == prevMaxFps) {
if ( m_bFixedFrameRateSet ) {
minFps = params.getPreviewFrameRate() * 1000;
maxFps = params.getPreviewFrameRate() * 1000;
m_bFixedFrameRateSet = false;
} else if (!updateNeeded) {
LOGH("No change in FpsRange");
rc = NO_ERROR;
goto end;
}
}
for(size_t i = 0; i < m_pCapability->fps_ranges_tbl_cnt; i++) {
// if the value is in the supported list
if (minFps >= m_pCapability->fps_ranges_tbl[i].min_fps * 1000 &&
maxFps <= m_pCapability->fps_ranges_tbl[i].max_fps * 1000) {
found = true;
LOGH("FPS i=%d : minFps = %d, maxFps = %d"
" vidMinFps = %d, vidMaxFps = %d",
i, minFps, maxFps,
(int)m_hfrFpsRange.video_min_fps,
(int)m_hfrFpsRange.video_max_fps);
if ((0.0f >= m_hfrFpsRange.video_min_fps) ||
(0.0f >= m_hfrFpsRange.video_max_fps)) {
vidMinFps = minFps;
vidMaxFps = maxFps;
}
else {
vidMinFps = (int)m_hfrFpsRange.video_min_fps;
vidMaxFps = (int)m_hfrFpsRange.video_max_fps;
}
setPreviewFpsRange(minFps, maxFps, vidMinFps, vidMaxFps);
break;
}
}
if(found == false){
LOGE("error: FPS range value not supported");
rc = BAD_VALUE;
}
end:
return rc;
}
/*===========================================================================
* FUNCTION : UpdateHFRFrameRate
*
* DESCRIPTION: set preview FPS range based on HFR setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : bool true/false
* true -if HAL needs to overwrite FPS range set by app, false otherwise.
*==========================================================================*/
bool QCameraParameters::UpdateHFRFrameRate(const QCameraParameters& params)
{
bool updateNeeded = false;
int min_fps, max_fps;
int32_t hfrMode = CAM_HFR_MODE_OFF;
int32_t newHfrMode = CAM_HFR_MODE_OFF;
int parm_minfps,parm_maxfps;
int prevMinFps, prevMaxFps;
CameraParameters::getPreviewFpsRange(&prevMinFps, &prevMaxFps);
params.getPreviewFpsRange(&parm_minfps, &parm_maxfps);
LOGH("CameraParameters - : minFps = %d, maxFps = %d ",
prevMinFps, prevMaxFps);
LOGH("Requested params - : minFps = %d, maxFps = %d ",
parm_minfps, parm_maxfps);
const char *hfrStr = params.get(KEY_QC_VIDEO_HIGH_FRAME_RATE);
const char *hsrStr = params.get(KEY_QC_VIDEO_HIGH_SPEED_RECORDING);
const char *prev_hfrStr = CameraParameters::get(KEY_QC_VIDEO_HIGH_FRAME_RATE);
const char *prev_hsrStr = CameraParameters::get(KEY_QC_VIDEO_HIGH_SPEED_RECORDING);
if ((hfrStr != NULL) && (prev_hfrStr != NULL) && strcmp(hfrStr, prev_hfrStr)) {
updateParamEntry(KEY_QC_VIDEO_HIGH_FRAME_RATE, hfrStr);
}
if ((hsrStr != NULL) && (prev_hsrStr != NULL) && strcmp(hsrStr, prev_hsrStr)) {
updateParamEntry(KEY_QC_VIDEO_HIGH_SPEED_RECORDING, hsrStr);
}
// check if HFR is enabled
if ((hfrStr != NULL) && strcmp(hfrStr, "off")) {
hfrMode = lookupAttr(HFR_MODES_MAP, PARAM_MAP_SIZE(HFR_MODES_MAP), hfrStr);
if (NAME_NOT_FOUND != hfrMode) newHfrMode = hfrMode;
}
// check if HSR is enabled
else if ((hsrStr != NULL) && strcmp(hsrStr, "off")) {
hfrMode = lookupAttr(HFR_MODES_MAP, PARAM_MAP_SIZE(HFR_MODES_MAP), hsrStr);
if (NAME_NOT_FOUND != hfrMode) newHfrMode = hfrMode;
}
LOGH("prevHfrMode - %d, currentHfrMode = %d ",
mHfrMode, newHfrMode);
if (mHfrMode != newHfrMode) {
updateNeeded = true;
mHfrMode = newHfrMode;
switch (mHfrMode) {
case CAM_HFR_MODE_60FPS:
min_fps = 60000;
max_fps = 60000;
break;
case CAM_HFR_MODE_90FPS:
min_fps = 90000;
max_fps = 90000;
break;
case CAM_HFR_MODE_120FPS:
min_fps = 120000;
max_fps = 120000;
break;
case CAM_HFR_MODE_150FPS:
min_fps = 150000;
max_fps = 150000;
break;
case CAM_HFR_MODE_180FPS:
min_fps = 180000;
max_fps = 180000;
break;
case CAM_HFR_MODE_210FPS:
min_fps = 210000;
max_fps = 210000;
break;
case CAM_HFR_MODE_240FPS:
min_fps = 240000;
max_fps = 240000;
break;
case CAM_HFR_MODE_480FPS:
min_fps = 480000;
max_fps = 480000;
break;
case CAM_HFR_MODE_OFF:
default:
// Set Video Fps to zero
min_fps = 0;
max_fps = 0;
break;
}
m_hfrFpsRange.video_min_fps = (float)min_fps;
m_hfrFpsRange.video_max_fps = (float)max_fps;
LOGH("HFR mode (%d) Set video FPS : minFps = %d, maxFps = %d ",
mHfrMode, min_fps, max_fps);
}
// Remember if HFR mode is ON
if ((mHfrMode > CAM_HFR_MODE_OFF) && (mHfrMode < CAM_HFR_MODE_MAX)) {
LOGH("HFR mode is ON");
m_bHfrMode = true;
} else {
m_hfrFpsRange.video_min_fps = 0;
m_hfrFpsRange.video_max_fps = 0;
m_bHfrMode = false;
LOGH("HFR mode is OFF");
}
m_hfrFpsRange.min_fps = (float)parm_minfps;
m_hfrFpsRange.max_fps = (float)parm_maxfps;
if (m_bHfrMode && (mHfrMode > CAM_HFR_MODE_120FPS)
&& (parm_maxfps != 0)) {
//Configure buffer batch count to use batch mode for higher fps
setBufBatchCount((int8_t)(m_hfrFpsRange.video_max_fps / parm_maxfps));
} else {
//Reset batch count and update KEY for encoder
setBufBatchCount(0);
}
return updateNeeded;
}
/*===========================================================================
* FUNCTION : setPreviewFrameRate
*
* DESCRIPTION: set preview frame rate from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setPreviewFrameRate(const QCameraParameters& params)
{
const char *str = params.get(KEY_PREVIEW_FRAME_RATE);
const char *prev_str = get(KEY_PREVIEW_FRAME_RATE);
if ( str ) {
if ( prev_str &&
strcmp(str, prev_str)) {
LOGD("Requested Fixed Frame Rate %s", str);
updateParamEntry(KEY_PREVIEW_FRAME_RATE, str);
m_bFixedFrameRateSet = true;
}
}
return NO_ERROR;
}
/*===========================================================================
* FUNCTION : setEffect
*
* DESCRIPTION: set effect value from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setEffect(const QCameraParameters& params)
{
const char *str = params.get(KEY_EFFECT);
const char *prev_str = get(KEY_EFFECT);
char prop[PROPERTY_VALUE_MAX];
memset(prop, 0, sizeof(prop));
property_get("persist.camera.effect", prop, "none");
if (strcmp(prop, "none")) {
if ((prev_str == NULL) ||
(strcmp(prop, prev_str) != 0) ||
(m_bUpdateEffects == true)) {
m_bUpdateEffects = false;
return setEffect(prop);
}
} else if (str != NULL) {
if ((prev_str == NULL) ||
(strcmp(str, prev_str) != 0) ||
(m_bUpdateEffects == true)) {
m_bUpdateEffects = false;
return setEffect(str);
}
}
return NO_ERROR;
}
/*===========================================================================
* FUNCTION : setFocusMode
*
* DESCRIPTION: set focus mode from user setting
*
* PARAMETERS :
* @params : user setting parameters
*
* RETURN : int32_t type of status
* NO_ERROR -- success
* none-zero failure code
*==========================================================================*/
int32_t QCameraParameters::setFocusMode(const QCameraParameters& params)
{
const char *str = params.get(KEY_FOCUS_MODE);
const char *prev_str = get(KEY_FOCUS_MODE);
if (str != NULL) {
if (prev_str == NULL ||
strcmp(str, prev_str) != 0