diff options
| author | xianming wang <mingwax@codeaurora.org> | 2017-12-13 10:24:16 +0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-02-06 21:47:40 -0800 |
| commit | ee8e5808ffa75f7ff77b8f8fbeb943bc8d451ce9 (patch) | |
| tree | 891d9bb3eecf280d8ec72775ab4def6e1f7a606d /src/com/android/camera/CaptureModule.java | |
| parent | 54b13709b379cb462c0592a8bebd4a9f13f0c586 (diff) | |
SnapdragonCamera: Complete the function of DeepZoom
Complete the function of DeepZoom, only support the 32 bit library.
Does`t support the 64 bit library.
CRs-Fixed: 2116533
Change-Id: I9c181ff0de005493d345ecc0b0380dda9910ce63
Diffstat (limited to 'src/com/android/camera/CaptureModule.java')
| -rwxr-xr-x | src/com/android/camera/CaptureModule.java | 79 |
1 files changed, 55 insertions, 24 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 24b9137fd..6539fa7d2 100755 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -334,6 +334,7 @@ public class CaptureModule implements CameraModule, PhotoController, private boolean mQuickCapture; private byte[] mJpegImageData; private boolean mSaveRaw = false; + private boolean mSupportZoomCapture = true; /** * A {@link CameraCaptureSession } for camera preview. @@ -1652,6 +1653,7 @@ public class CaptureModule implements CameraModule, PhotoController, Log.d(TAG, "captureStillPicture " + id); mJpegImageData = null; mIsRefocus = false; + if (isDeepZoom()) mSupportZoomCapture = false; try { if (null == mActivity || null == mCameraDevice[id]) { warningToast("Camera is not ready yet to take a picture."); @@ -1671,7 +1673,7 @@ public class CaptureModule implements CameraModule, PhotoController, applySettingsForJpegInformation(captureBuilder, id); applyAFRegions(captureBuilder, id); applyAERegions(captureBuilder, id); - if (!mIsSupportedQcfa) { + if (!mIsSupportedQcfa || !isDeepZoom()) { addPreviewSurface(captureBuilder, null, id); } VendorTagUtil.setCdsMode(captureBuilder, 2);// CDS 0-OFF, 1-ON, 2-AUTO @@ -1682,6 +1684,7 @@ public class CaptureModule implements CameraModule, PhotoController, captureBuilder.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_OFF); } + if (isDeepZoom()) mSupportZoomCapture = true; if(isClearSightOn()) { captureStillPictureForClearSight(id); } else if(id == getMainCameraId() && mPostProcessor.isFilterOn()) { // Case of post filtering @@ -1744,7 +1747,9 @@ public class CaptureModule implements CameraModule, PhotoController, //CameraDevice was already closed return; } - mCaptureSession[id].stopRepeating(); + if (!isDeepZoom()) { + mCaptureSession[id].stopRepeating(); + } captureBuilder.addTarget(mImageReader[id].getSurface()); if (mSaveRaw) { captureBuilder.addTarget(mRawImageReader[id].getSurface()); @@ -2585,6 +2590,8 @@ public class CaptureModule implements CameraModule, PhotoController, return PostProcessor.FILTER_SHARPSHOOTER; } else if (mode == SettingsManager.SCENE_MODE_BESTPICTURE_INT) { return PostProcessor.FILTER_BESTPICTURE; + } else if (mode == SettingsManager.SCENE_MODE_DEEPZOOM_INT) { + return PostProcessor.FILTER_DEEPZOOM; } return PostProcessor.FILTER_NONE; } @@ -2842,28 +2849,7 @@ public class CaptureModule implements CameraModule, PhotoController, @Override public void onZoomChanged(float requestedZoom) { mZoomValue = requestedZoom; - - if (isBackCamera()) { - switch (getCameraMode()) { - case DUAL_MODE: - applyZoomAndUpdate(BAYER_ID); - applyZoomAndUpdate(MONO_ID); - break; - case BAYER_MODE: - applyZoomAndUpdate(BAYER_ID); - break; - case MONO_MODE: - applyZoomAndUpdate(MONO_ID); - break; - case SWITCH_MODE: - applyZoomAndUpdate(SWITCH_ID); - break; - } - } else { - int cameraId = SWITCH_ID == -1? FRONT_ID : SWITCH_ID; - applyZoomAndUpdate(cameraId); - } - mUI.updateFaceViewCameraBound(mCropRegion[getMainCameraId()]); + applyZoomAndUpdate(); } private boolean isInMode(int cameraId) { @@ -3403,6 +3389,35 @@ public class CaptureModule implements CameraModule, PhotoController, } } + public void updateDeepZoomIndex(float zoom) { + mZoomValue = zoom; + applyZoomAndUpdate(); + } + + private void applyZoomAndUpdate() { + if (isBackCamera()) { + switch (getCameraMode()) { + case DUAL_MODE: + applyZoomAndUpdate(BAYER_ID); + applyZoomAndUpdate(MONO_ID); + break; + case BAYER_MODE: + applyZoomAndUpdate(BAYER_ID); + break; + case MONO_MODE: + applyZoomAndUpdate(MONO_ID); + break; + case SWITCH_MODE: + applyZoomAndUpdate(SWITCH_ID); + break; + } + } else { + int cameraId = SWITCH_ID == -1 ? FRONT_ID : SWITCH_ID; + applyZoomAndUpdate(cameraId); + } + mUI.updateFaceViewCameraBound(mCropRegion[getMainCameraId()]); + } + private void updateZoom() { String zoomStr = mSettingsManager.getValue(SettingsManager.KEY_ZOOM); int zoom = Integer.parseInt(zoomStr); @@ -3411,6 +3426,9 @@ public class CaptureModule implements CameraModule, PhotoController, }else{ mZoomValue = 1.0f; } + if (isDeepZoom()) { + mZoomValue = mUI.getDeepZoomValue(); + } } private boolean startRecordingVideo(final int cameraId) { @@ -4459,6 +4477,7 @@ public class CaptureModule implements CameraModule, PhotoController, } private void applyZoom(CaptureRequest.Builder request, int id) { + if (!mSupportZoomCapture) return; request.set(CaptureRequest.SCALER_CROP_REGION, cropRegionForZoom(id)); } @@ -5231,6 +5250,18 @@ public class CaptureModule implements CameraModule, PhotoController, return false; } + public boolean isDeepZoom() { + String value = mSettingsManager.getValue(SettingsManager.KEY_SCENE_MODE); + try { + int mode = Integer.parseInt(value); + if(mode == SettingsManager.SCENE_MODE_DEEPZOOM_INT) { + return true; + } + } catch(Exception e) { + } + return false; + } + private void updateFaceDetection() { final String value = mSettingsManager.getValue(SettingsManager.KEY_FACE_DETECTION); mActivity.runOnUiThread(new Runnable() { |
