blob: 3b1aa0b768e83835e39711c46fbf8ccab6e1e376 [file] [log] [blame]
/*
**
** Copyright 2015, Samsung Electronics Co. LTD
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#ifndef EXYNOS_CAMERA_PARAMETERS_H
#define EXYNOS_CAMERA_PARAMETERS_H
#include <utils/threads.h>
#include <utils/RefBase.h>
#include <utils/String8.h>
#include <cutils/properties.h>
#include <camera/CameraParameters.h>
#include <videodev2.h>
#include <videodev2_exynos_media.h>
#include <videodev2_exynos_camera.h>
#ifdef USE_CSC_FEATURE
#include <SecNativeFeature.h>
#endif
#include "ExynosCameraConfig.h"
#include "ExynosCameraSensorInfoBase.h"
#include "ExynosCameraCounter.h"
#include "fimc-is-metadata.h"
#include "ExynosRect.h"
#include "exynos_format.h"
#include "ExynosExif.h"
#include "ExynosCameraUtils.h"
//#include "ExynosCameraUtilsModule.h"
#include "ExynosCameraActivityControl.h"
#include "ExynosCameraAutoTimer.h"
#ifdef SAMSUNG_TN_FEATURE
#include "SecCameraParameters.h"
#endif
#if 0//def SUPPORT_SW_VDIS
#include "SecCameraSWVdis.h"
#endif /*SUPPORT_SW_VDIS*/
#ifdef SUPPORT_SW_VDIS
#include "SecCameraSWVdis_3_0.h"
#endif /*SUPPORT_SW_VDIS*/
#ifdef SAMSUNG_OIS
#include"ExynosCameraNode.h"
#endif
#include <map>
#define EXYNOS_CONFIG_DEFINED (-1)
#define EXYNOS_CONFIG_NOTDEFINED (-2)
#define STATE_REG_BINNING_MODE (1<<28)
#define STATE_REG_MANUAL_ISO (1<<26)
#define STATE_REG_LONG_CAPTURE (1<<24)
#define STATE_REG_SHARPEN_SINGLE (1<<22)
#define STATE_REG_RTHDR_AUTO (1<<20)
#define STATE_REG_NEED_LLS (1<<18)
#define STATE_REG_ZOOM_INDOOR (1<<16)
#define STATE_REG_ZOOM_OUTDOOR (1<<14)
#define STATE_REG_ZOOM (1<<12)
#define STATE_REG_RTHDR_ON (1<<10)
#define STATE_REG_RECORDINGHINT (1<<8)
#define STATE_REG_DUAL_RECORDINGHINT (1<<6)
#define STATE_REG_UHD_RECORDING (1<<4)
#define STATE_REG_DUAL_MODE (1<<2)
#define STATE_REG_FLAG_REPROCESSING (1)
#define STATE_STILL_PREVIEW (0)
#define STATE_STILL_PREVIEW_WDR_ON (STATE_REG_RTHDR_ON)
#define STATE_STILL_PREVIEW_WDR_AUTO (STATE_REG_RTHDR_AUTO)
#define STATE_STILL_PREVIEW_LLS (STATE_REG_NEED_LLS)
#define STATE_STILL_CAPTURE (STATE_REG_FLAG_REPROCESSING)
#define STATE_STILL_CAPTURE_ZOOM (STATE_REG_FLAG_REPROCESSING|STATE_REG_ZOOM)
#define STATE_STILL_CAPTURE_ZOOM_OUTDOOR (STATE_REG_FLAG_REPROCESSING|STATE_REG_ZOOM_OUTDOOR)
#define STATE_STILL_CAPTURE_ZOOM_INDOOR (STATE_REG_FLAG_REPROCESSING|STATE_REG_ZOOM_INDOOR)
#define STATE_VIDEO_CAPTURE (STATE_REG_FLAG_REPROCESSING|STATE_REG_RECORDINGHINT)
#define STATE_STILL_CAPTURE_LLS (STATE_REG_FLAG_REPROCESSING|STATE_REG_NEED_LLS)
#define STATE_STILL_CAPTURE_WDR_ON (STATE_REG_RTHDR_ON|STATE_REG_FLAG_REPROCESSING)
#define STATE_STILL_CAPTURE_WDR_ON_ZOOM (STATE_REG_RTHDR_ON|STATE_REG_FLAG_REPROCESSING|STATE_REG_ZOOM)
#define STATE_STILL_CAPTURE_WDR_ON_ZOOM_OUTDOOR (STATE_REG_RTHDR_ON|STATE_REG_FLAG_REPROCESSING|STATE_REG_ZOOM_OUTDOOR)
#define STATE_STILL_CAPTURE_WDR_ON_ZOOM_INDOOR (STATE_REG_RTHDR_ON|STATE_REG_FLAG_REPROCESSING|STATE_REG_ZOOM_INDOOR)
#define STATE_VIDEO_CAPTURE_WDR_ON (STATE_REG_RTHDR_ON|STATE_REG_FLAG_REPROCESSING|STATE_REG_RECORDINGHINT)
#define STATE_VIDEO_CAPTURE_WDR_ON_LLS (STATE_REG_RTHDR_ON|STATE_REG_FLAG_REPROCESSING|STATE_REG_NEED_LLS)
#define STATE_STILL_CAPTURE_WDR_AUTO (STATE_REG_RTHDR_AUTO|STATE_REG_FLAG_REPROCESSING)
#define STATE_STILL_CAPTURE_WDR_AUTO_ZOOM (STATE_REG_RTHDR_AUTO|STATE_REG_FLAG_REPROCESSING|STATE_REG_ZOOM)
#define STATE_STILL_CAPTURE_WDR_AUTO_ZOOM_OUTDOOR (STATE_REG_RTHDR_AUTO|STATE_REG_FLAG_REPROCESSING|STATE_REG_ZOOM_OUTDOOR)
#define STATE_STILL_CAPTURE_WDR_AUTO_ZOOM_INDOOR (STATE_REG_RTHDR_AUTO|STATE_REG_FLAG_REPROCESSING|STATE_REG_ZOOM_INDOOR)
#define STATE_VIDEO_CAPTURE_WDR_AUTO (STATE_REG_RTHDR_AUTO|STATE_REG_FLAG_REPROCESSING|STATE_REG_RECORDINGHINT)
#define STATE_STILL_CAPTURE_WDR_AUTO_LLS (STATE_REG_RTHDR_AUTO|STATE_REG_FLAG_REPROCESSING|STATE_REG_NEED_LLS)
#define STATE_VIDEO (STATE_REG_RECORDINGHINT)
#define STATE_VIDEO_WDR_ON (STATE_REG_RECORDINGHINT|STATE_REG_RTHDR_ON)
#define STATE_VIDEO_WDR_AUTO (STATE_REG_RECORDINGHINT|STATE_REG_RTHDR_AUTO)
#define STATE_DUAL_VIDEO (STATE_REG_DUAL_RECORDINGHINT|STATE_REG_DUAL_MODE)
#define STATE_DUAL_VIDEO_CAPTURE (STATE_REG_DUAL_RECORDINGHINT|STATE_REG_DUAL_MODE|STATE_REG_FLAG_REPROCESSING)
#define STATE_DUAL_STILL_PREVIEW (STATE_REG_DUAL_MODE)
#define STATE_DUAL_STILL_CAPTURE (STATE_REG_DUAL_MODE|STATE_REG_FLAG_REPROCESSING)
#define STATE_UHD_PREVIEW (STATE_REG_UHD_RECORDING)
#define STATE_UHD_PREVIEW_WDR_ON (STATE_REG_UHD_RECORDING|STATE_REG_RTHDR_ON)
#define STATE_UHD_PREVIEW_WDR_AUTO (STATE_REG_UHD_RECORDING|STATE_REG_RTHDR_AUTO)
#define STATE_UHD_VIDEO (STATE_REG_UHD_RECORDING|STATE_REG_RECORDINGHINT)
#define STATE_UHD_VIDEO_WDR_ON (STATE_REG_UHD_RECORDING|STATE_REG_RECORDINGHINT|STATE_REG_RTHDR_ON)
#define STATE_UHD_VIDEO_WDR_AUTO (STATE_REG_UHD_RECORDING|STATE_REG_RECORDINGHINT|STATE_REG_RTHDR_AUTO)
#define STATE_UHD_PREVIEW_CAPTURE (STATE_REG_UHD_RECORDING|STATE_REG_FLAG_REPROCESSING)
#define STATE_UHD_PREVIEW_CAPTURE_WDR_ON (STATE_REG_UHD_RECORDING|STATE_REG_FLAG_REPROCESSING|STATE_REG_RTHDR_ON)
#define STATE_UHD_PREVIEW_CAPTURE_WDR_AUTO (STATE_REG_UHD_RECORDING|STATE_REG_FLAG_REPROCESSING|STATE_REG_RTHDR_AUTO)
#define STATE_UHD_VIDEO_CAPTURE (STATE_REG_UHD_RECORDING|STATE_REG_RECORDINGHINT|STATE_REG_FLAG_REPROCESSING)
#define STATE_UHD_VIDEO_CAPTURE_WDR_ON (STATE_REG_UHD_RECORDING|STATE_REG_RECORDINGHINT|STATE_REG_FLAG_REPROCESSING|STATE_REG_RTHDR_ON)
#define STATE_UHD_VIDEO_CAPTURE_WDR_AUTO (STATE_REG_UHD_RECORDING|STATE_REG_RECORDINGHINT|STATE_REG_FLAG_REPROCESSING|STATE_REG_RTHDR_AUTO)
#define STATE_STILL_BINNING_PREVIEW (STATE_REG_BINNING_MODE)
#define STATE_VIDEO_BINNING (STATE_REG_RECORDINGHINT|STATE_REG_BINNING_MODE)
#define STATE_DUAL_STILL_BINING_PREVIEW (STATE_REG_DUAL_MODE|STATE_REG_BINNING_MODE)
#define STATE_DUAL_VIDEO_BINNING (STATE_REG_DUAL_RECORDINGHINT|STATE_REG_DUAL_MODE|STATE_REG_BINNING_MODE)
namespace android {
using namespace std;
namespace CONFIG_MODE {
enum MODE {
NORMAL = 0x00,
HIGHSPEED_60,
HIGHSPEED_120,
HIGHSPEED_240,
MAX
};
};
struct CONFIG_PIPE {
uint32_t prepare[MAX_PIPE_NUM_REPROCESSING];
};
struct CONFIG_BUFFER {
uint32_t num_sensor_buffers;
uint32_t num_bayer_buffers;
uint32_t init_bayer_buffers;
uint32_t num_3aa_buffers;
uint32_t num_hwdis_buffers;
uint32_t num_vra_buffers;
uint32_t num_preview_buffers;
uint32_t num_preview_cb_buffers;
uint32_t num_picture_buffers;
uint32_t num_reprocessing_buffers;
uint32_t num_recording_buffers;
uint32_t num_fastaestable_buffer;
uint32_t reprocessing_bayer_hold_count;
uint32_t front_num_bayer_buffers;
uint32_t front_num_picture_buffers;
uint32_t preview_buffer_margin;
/* for USE_CAMERA2_API_SUPPORT */
uint32_t num_request_raw_buffers;
uint32_t num_request_preview_buffers;
uint32_t num_request_callback_buffers;
uint32_t num_request_video_buffers;
uint32_t num_request_jpeg_buffers;
uint32_t num_min_block_request;
uint32_t num_max_block_request;
/* for USE_CAMERA2_API_SUPPORT */
};
struct CONFIG_BUFFER_PIPE {
struct CONFIG_PIPE pipeInfo;
struct CONFIG_BUFFER bufInfo;
};
struct ExynosConfigInfo {
struct CONFIG_BUFFER_PIPE *current;
struct CONFIG_BUFFER_PIPE info[CONFIG_MODE::MAX];
uint32_t mode;
};
class IMetadata {
public:
IMetadata(){};
virtual ~IMetadata(){};
virtual status_t duplicateCtrlMetadata(void *buf) = 0;
};
class IHWConfig {
public:
IHWConfig(){};
virtual ~IHWConfig(){};
virtual bool getUsePureBayerReprocessing(void) = 0;
virtual bool isSccCapture(void) = 0;
virtual bool isReprocessing(void) = 0;
virtual status_t getFastenAeStableBcropSize(int *hwBcropW, int *hwBcropH) = 0;
virtual void getHwBayerCropRegion(int *w, int *h, int *x, int *y) = 0;
virtual void getHwPreviewSize(int *w, int *h) = 0;
virtual void getVideoSize(int *w, int *h) = 0;
virtual void getPictureSize(int *w, int *h) = 0;
virtual bool getHWVdisMode(void) = 0;
virtual status_t getPictureBayerCropSize(ExynosRect *srcRect, ExynosRect *dstRect) = 0;
virtual status_t getPictureBdsSize(ExynosRect *dstRect) = 0;
virtual void getHwSensorSize(int *w, int *h) = 0;
virtual bool isReprocessing3aaIspOTF(void) = 0;
virtual int getHwPreviewFormat(void) = 0;
virtual bool getDvfsLock(void) = 0;
virtual void getMaxSensorSize(int *w, int *h) = 0;
virtual status_t getPreviewBayerCropSize(ExynosRect *srcRect, ExynosRect *dstRect) = 0;
virtual status_t getPreviewBdsSize(ExynosRect *dstRect) = 0;
virtual bool getUseDynamicScc(void) = 0;
virtual bool getUseDynamicBayerVideoSnapShot(void) = 0;
virtual int getHWVdisFormat(void) = 0;
virtual void getHwVraInputSize(int *w, int *h) = 0;
virtual int getHwVraInputFormat(void) = 0;
virtual uint32_t getBnsScaleRatio(void) = 0;
virtual bool needGSCForCapture(int camId) = 0;
virtual bool getSetFileCtlMode(void) = 0;
virtual bool getSetFileCtl3AA_ISP(void) = 0;
virtual bool getSetFileCtl3AA(void) = 0;
virtual bool getSetFileCtlISP(void) = 0;
virtual bool getSetFileCtlSCP(void) = 0;
virtual uint64_t getCaptureExposureTime(void) = 0;
virtual bool isUseEarlyFrameReturn(void) {return false;};
};
class IModeConfig {
public:
IModeConfig(){};
virtual ~IModeConfig(){};
virtual bool getHdrMode(void) = 0;
virtual bool getRecordingHint(void) = 0;
virtual int getFocusMode(void) = 0;
virtual int getZoomLevel(void) = 0;
virtual void getSetfileYuvRange(bool flagReprocessing, int *setfile, int *yuvRange) = 0;
virtual float getZoomRatio(int zoom) = 0;
virtual struct ExynosConfigInfo *getConfig() = 0;
virtual void setFlipHorizontal(int val) = 0;
virtual int getFlipHorizontal(void) = 0;
virtual void setFlipVertical(int val) = 0;
virtual int getFlipVertical(void) = 0;
virtual int getPictureFormat(void) = 0;
virtual status_t getFdMeta(bool reprocessing, void *buf) = 0;
virtual float getMaxZoomRatio(void)= 0;
virtual int getHalVersion(void) = 0;
// virtual int getGrallocUsage(void) = 0;
// virtual int getGrallocLockUsage(void) = 0;
virtual int getHDRDelay(void) = 0;
virtual int getReprocessingBayerHoldCount(void) = 0;
virtual int getFastenAeFps(void) = 0;
virtual int getPerFrameControlPipe(void) = 0;
virtual int getPerFrameControlReprocessingPipe(void) = 0;
virtual int getPerFrameInfo3AA(void) = 0;
virtual int getPerFrameInfoIsp(void) = 0;
virtual int getPerFrameInfoDis(void) = 0;
virtual int getPerFrameInfoReprocessingPure3AA(void) = 0;
virtual int getPerFrameInfoReprocessingPureIsp(void) = 0;
virtual int getScalerNodeNumPicture(void) = 0;
virtual bool isOwnScc(int cameraId) = 0;
};
class IModeVendorConfig {
public:
IModeVendorConfig(){};
virtual ~IModeVendorConfig(){};
virtual int getShotMode(void) = 0;
// virtual bool getOISCaptureModeOn(void) = 0;
// virtual void setOISCaptureModeOn(bool enable) = 0;
virtual int getSeriesShotCount(void) = 0;
virtual bool getHighResolutionCallbackMode(void) = 0;
};
class IActivityController {
public:
IActivityController(){};
virtual ~IActivityController(){};
virtual ExynosCameraActivityControl *getActivityControl(void) = 0;
};
class IJpegConfig {
public:
IJpegConfig(){};
virtual ~IJpegConfig(){};
virtual int getJpegQuality(void) = 0;
virtual int getThumbnailQuality(void) = 0;
virtual status_t getFixedExifInfo(exif_attribute_t *exifInfo) = 0;
virtual debug_attribute_t *getDebugAttribute(void) = 0;
virtual void getThumbnailSize(int *w, int *h) = 0;
virtual void setExifChangedAttribute(exif_attribute_t *exifInfo,
ExynosRect *PictureRect,
ExynosRect *thumbnailRect,
camera2_shot_t *shot) = 0;
};
class ISensorStaticInfo {
public:
ISensorStaticInfo(){};
virtual ~ISensorStaticInfo(){};
virtual struct ExynosSensorInfoBase *getSensorStaticInfo() = 0;
};
class ExynosCameraParameters : public IMetadata, public IHWConfig, public IModeConfig, public IModeVendorConfig, public IActivityController, public IJpegConfig, public ISensorStaticInfo {
public:
ExynosCameraParameters(){};
virtual ~ExynosCameraParameters(){};
//class Interface Metadata
virtual status_t duplicateCtrlMetadata(void *buf);
//class Interface HWConfig
virtual bool getUsePureBayerReprocessing(void) = 0;
virtual bool isSccCapture(void) = 0;
virtual bool isReprocessing(void) = 0;
virtual status_t getFastenAeStableBcropSize(int *hwBcropW, int *hwBcropH) = 0;
virtual void getHwBayerCropRegion(int *w, int *h, int *x, int *y) = 0;
virtual void getHwPreviewSize(int *w, int *h) = 0;
virtual void getPictureSize(int *w, int *h) = 0;
virtual void getYuvSize(int *w, int *h, int index) = 0;
virtual bool getHWVdisMode(void) = 0;
virtual status_t getPictureBayerCropSize(ExynosRect *srcRect, ExynosRect *dstRect) = 0;
virtual void getHwSensorSize(int *w, int *h) = 0;
virtual status_t getPictureBdsSize(ExynosRect *dstRect) = 0;
virtual bool isReprocessing3aaIspOTF(void) = 0;
virtual int getHwPreviewFormat(void) = 0;
virtual bool getDvfsLock(void) = 0;
virtual void getMaxSensorSize(int *w, int *h) = 0;
virtual status_t getPreviewBayerCropSize(ExynosRect *srcRect, ExynosRect *dstRect) = 0;
virtual status_t getPreviewBdsSize(ExynosRect *dstRect) = 0;
virtual bool getUseDynamicScc(void) = 0;
virtual bool getUseDynamicBayerVideoSnapShot(void) = 0;
virtual int getHWVdisFormat(void) = 0;
virtual void getHwVraInputSize(int *w, int *h) = 0;
virtual int getHwVraInputFormat(void) = 0;
virtual uint32_t getBnsScaleRatio(void) = 0;
virtual bool needGSCForCapture(int camId) = 0;
virtual bool getSetFileCtlMode(void) = 0;
virtual bool getSetFileCtl3AA_ISP(void) = 0;
virtual bool getSetFileCtl3AA(void) = 0;
virtual bool getSetFileCtlISP(void) = 0;
virtual bool getSetFileCtlSCP(void) = 0;
virtual uint64_t getCaptureExposureTime(void) = 0;
virtual bool isUseEarlyFrameReturn(void) {return false;};
virtual bool isUseThumbnailHWFC(void) = 0;
virtual bool isMcscVraOtf(void) = 0;
virtual int32_t getLongExposureShotCount(void) = 0;
//class Interface ModeConfig
virtual bool getHdrMode(void) = 0;
virtual bool getRecordingHint(void) = 0;
virtual int getFocusMode(void) = 0;
virtual int getZoomLevel(void) = 0;
virtual void getSetfileYuvRange(bool flagReprocessing, int *setfile, int *yuvRange) = 0;
virtual float getZoomRatio(int zoom) = 0;
virtual struct ExynosConfigInfo *getConfig() = 0;
virtual void setFlipHorizontal(int val) = 0;
virtual int getFlipHorizontal(void) = 0;
virtual void setFlipVertical(int val) = 0;
virtual int getFlipVertical(void) = 0;
virtual int getPictureFormat(void) = 0;
virtual int getHwPictureFormat(void) = 0;
virtual int getHalVersion(void) = 0;
#ifdef DEBUG_RAWDUMP
virtual bool checkBayerDumpEnable(void) = 0;
#endif/* DEBUG_RAWDUMP */
#ifdef RAWDUMP_CAPTURE
virtual void setRawCaptureModeOn(bool enable) = 0;
virtual bool getRawCaptureModeOn(void) = 0;
#endif /* RAWDUMP_CAPTURE */
// virtual int getGrallocUsage(void) = 0;
// virtual int getGrallocLockUsage(void) = 0;
virtual int getHDRDelay(void) = 0;
virtual int getReprocessingBayerHoldCount(void) = 0;
virtual int getFastenAeFps(void) = 0;
virtual int getPerFrameControlPipe(void) = 0;
virtual int getPerFrameControlReprocessingPipe(void) = 0;
virtual int getPerFrameInfo3AA(void) = 0;
virtual int getPerFrameInfoIsp(void) = 0;
virtual int getPerFrameInfoDis(void) = 0;
virtual int getPerFrameInfoReprocessingPure3AA(void) = 0;
virtual int getPerFrameInfoReprocessingPureIsp(void) = 0;
virtual int getScalerNodeNumPicture(void) = 0;
virtual int getScalerNodeNumPreview(void) = 0;
virtual int getScalerNodeNumVideo(void) = 0;
virtual bool isOwnScc(int cameraId) = 0;
virtual bool getTpuEnabledMode(void) = 0;
virtual int getCameraId(void) = 0;
//class Interface ModeVendorConfig
virtual int getShotMode(void) = 0;
virtual bool getOISCaptureModeOn(void){return false;};
virtual void setOISCaptureModeOn(__unused bool enable){};
virtual int getSeriesShotCount(void) = 0;
virtual bool getHighResolutionCallbackMode(void) = 0;
virtual void setNormalBestFrameCount(__unused uint32_t count){};
virtual uint32_t getNormalBestFrameCount(void){return 0;};
virtual void resetNormalBestFrameCount(void){};
virtual void setSCPFrameCount(__unused uint32_t count){};
virtual uint32_t getSCPFrameCount(void){return 0;};
virtual void resetSCPFrameCount(void){};
virtual void setBayerFrameCount(__unused uint32_t count){};
virtual uint32_t getBayerFrameCount(void){return 0;};
virtual void resetBayerFrameCount(void){};
virtual bool getUseBestPic(void){return false;};
virtual int getSeriesShotMode(void) = 0;
virtual void setLLSCaptureCount(__unused int count){};
virtual int getLLSCaptureCount(){return 0;};
//class Interface ActivityController
virtual ExynosCameraActivityControl *getActivityControl(void) = 0;
//class Interface JpegConfig
virtual int getJpegQuality(void) = 0;
virtual int getThumbnailQuality(void) = 0;
virtual status_t getFixedExifInfo(exif_attribute_t *exifInfo) = 0;
virtual debug_attribute_t *getDebugAttribute(void) = 0;
virtual void getThumbnailSize(int *w, int *h) = 0;
virtual void setExifChangedAttribute(exif_attribute_t *exifInfo,
ExynosRect *PictureRect,
ExynosRect *thumbnailRect,
camera2_shot_t *shot) = 0;
virtual status_t setMarkingOfExifFlash(int flag) = 0;
virtual int getMarkingOfExifFlash(void) = 0;
//Sensor Static Info
virtual struct ExynosSensorInfoBase *getSensorStaticInfo() = 0;
};
#if 0
class ExynosCameraConfiguration {
public:
/* Constructor */
ExynosCameraConfiguration(int cameraId);
/* Destructor */
virtual ~ExynosCameraConfiguration();
status_t addKeyTable(int *keyTable);
int getKey(int key);
/* status_t setKey(int key, int value); */
protected:
typedef map<int, int> ConfigMap;
};
#endif
}; /* namespace android */
#endif