Camera: Enable HDR mode
* Trigger HDR mode when HDR Scene mode is selected
* Skip raw and jpeg images for HDR
Native HDR solution generates 3 RAW images and 2 JPEG images, whereas
camera service only expect 1 RAW and 1 JPEG image. Add the frame skipping.
Change-Id: I083e8e5ae8245146a6e62fb96e9ca5b9a9a9f309
diff --git a/camera/QCameraHWI_Parm.cpp b/camera/QCameraHWI_Parm.cpp
index b926dd7..b506b1a 100644
--- a/camera/QCameraHWI_Parm.cpp
+++ b/camera/QCameraHWI_Parm.cpp
@@ -363,7 +363,6 @@
static const str_map hdr_bracket[] = {
{ QCameraParameters::AE_BRACKET_HDR_OFF,HDR_BRACKETING_OFF},
{ QCameraParameters::AE_BRACKET_HDR,HDR_MODE },
- { QCameraParameters::AE_BRACKET,EXP_BRACKETING_MODE }
};
typedef enum {
@@ -3043,6 +3042,7 @@
status_t QCameraHardwareInterface::setAEBracket(const QCameraParameters& params)
{
+ const char *str;
if(!cam_config_is_parm_supported(mCameraId,MM_CAMERA_PARM_HDR) || (myMode & CAMERA_ZSL_MODE)) {
ALOGV("Parameter HDR is not supported for this sensor/ ZSL mode");
@@ -3058,7 +3058,12 @@
return NO_ERROR;
}
- const char *str = params.get(QCameraParameters::KEY_AE_BRACKET_HDR);
+ const char *str2 = params.get(QCameraParameters::KEY_SCENE_MODE);
+ if(!strcmp(str2, "hdr")) {
+ str="HDR";
+ } else {
+ str = params.get(QCameraParameters::KEY_AE_BRACKET_HDR);
+ }
if (str != NULL) {
int value = attr_lookup(hdr_bracket,
diff --git a/camera/QCameraHWI_Still.cpp b/camera/QCameraHWI_Still.cpp
index e1aa098..d81605c 100644
--- a/camera/QCameraHWI_Still.cpp
+++ b/camera/QCameraHWI_Still.cpp
@@ -31,7 +31,6 @@
#define THUMBNAIL_DEFAULT_WIDTH 512
#define THUMBNAIL_DEFAULT_HEIGHT 384
-
/* following code implement the still image capture & encoding logic of this class*/
namespace android {
@@ -275,7 +274,8 @@
camera_memory_t *encodedMem = NULL;
camera_data_callback jpg_data_cb = NULL;
bool fail_cb_flag = false;
-
+ if (mHalCamCtrl->mHdrMode == HDR_MODE)
+ hdrJpegCount++;
//Mutex::Autolock l(&snapshotLock);
mStopCallbackLock.lock( );
if(!mActive && !isLiveSnapshot()) {
@@ -307,7 +307,6 @@
free(mCurrentFrameEncoded);
mCurrentFrameEncoded = NULL;
}
-
/* Before leaving check the jpeg queue. If it's not empty give the available
frame for encoding*/
if (!mSnapshotQueue.isEmpty()) {
@@ -319,6 +318,7 @@
fail_cb_flag = true;
}
} else if (mNumOfSnapshot == mNumOfRecievedJPEG ) { /* finished */
+ ALOGD("nusnap %d, mNumjpeg %d", mNumOfSnapshot, mNumOfRecievedJPEG);
ALOGD("%s: Before omxJpegFinish", __func__);
omxJpegFinish();
ALOGD("%s: After omxJpegFinish", __func__);
@@ -357,6 +357,9 @@
}
memcpy(encodedMem->data, mHalCamCtrl->mJpegMemory.camera_memory[0]->data, mJpegOffset );
mStopCallbackLock.unlock( );
+ if(mHalCamCtrl->mHdrMode == HDR_MODE && (hdrJpegCount%2) != 0)
+ return;
+
if ((mActive || isLiveSnapshot()) && jpg_data_cb != NULL) {
ALOGV("%s: Calling upperlayer callback to store JPEG image", __func__);
jpg_data_cb (msg_type,encodedMem, 0, NULL,mHalCamCtrl->mCallbackCookie);
@@ -1268,6 +1271,10 @@
ALOGD("%s: E", __func__);
+ if (mHalCamCtrl->mHdrMode == HDR_MODE) {
+ hdrRawCount = 0;
+ hdrJpegCount = 0;
+ }
/* Take snapshot */
ALOGD("%s: Call MM_CAMERA_OPS_SNAPSHOT", __func__);
if (NO_ERROR != cam_ops_action(mCameraId,
@@ -1939,6 +1946,12 @@
notifyShutter(&crop, FALSE);
mHalCamCtrl->mShutterSoundPlayed = FALSE;
+ if(mHalCamCtrl->mHdrMode == HDR_MODE) {
+ if ((hdrRawCount % 3) != 2)
+ return NO_ERROR;
+ else
+ hdrRawCount++;
+ }
if (rc != NO_ERROR)
{
diff --git a/camera/QCameraStream.h b/camera/QCameraStream.h
index 5a1b277..acaa05e 100644
--- a/camera/QCameraStream.h
+++ b/camera/QCameraStream.h
@@ -385,6 +385,8 @@
bool mDropThumbnail;
int mJpegQuality;
snap_hdr_record_t mHdrInfo;
+ int hdrRawCount;
+ int hdrJpegCount;
}; // QCameraStream_Snapshot