diff options
author | Weijie Wang <weijiew@codeaurora.org> | 2017-08-29 19:51:59 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-09-14 05:01:00 -0700 |
commit | 9e28fca9f16f96a054ea17ab0df14df05b8d0e55 (patch) | |
tree | 1aa6e1b60a1c8d82688166bf5cd58a6bd2c0ef64 /src/com/android/camera | |
parent | f47cca2d5e92cf2ed9ed154c32995e1e7e38b176 (diff) | |
download | android_packages_apps_Snap-9e28fca9f16f96a054ea17ab0df14df05b8d0e55.tar.gz android_packages_apps_Snap-9e28fca9f16f96a054ea17ab0df14df05b8d0e55.tar.bz2 android_packages_apps_Snap-9e28fca9f16f96a054ea17ab0df14df05b8d0e55.zip |
SnapdragonCamera: Support HFR 60 and 90 fps
Support HFR 60 and 90 fps
Change-Id: Ib615196e691782ee6d595d5216f2966cee284a9c
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 4 | ||||
-rw-r--r-- | src/com/android/camera/SettingsManager.java | 55 |
2 files changed, 21 insertions, 38 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 50cf0aa2b..d2ce09fd8 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -192,7 +192,7 @@ public class CaptureModule implements CameraModule, PhotoController, // we can change it based on memory status or other requirements. private static final int LONGSHOT_CANCEL_THRESHOLD = 40 * 1024 * 1024; - private static final int NORMAL_SESSION_MAX_FPS = 60; + private static final int NORMAL_SESSION_MAX_FPS = 30; private static final int SCREEN_DELAY = 2 * 60 * 1000; @@ -249,6 +249,8 @@ public class CaptureModule implements CameraModule, PhotoController, public static CaptureResult.Key<byte[]> gazeDegree = new CaptureResult.Key<>("org.codeaurora.qcamera3.stats.gaze_degree", byte[].class); + public static final CameraCharacteristics.Key<int[]> hfrSizeList = + new CameraCharacteristics.Key<>("org.codeaurora.qcamera3.hfr.sizes", int[].class); private boolean[] mTakingPicture = new boolean[MAX_NUM_CAM]; private int mControlAFMode = CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE; diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java index af796c6a7..d976cb3a0 100644 --- a/src/com/android/camera/SettingsManager.java +++ b/src/com/android/camera/SettingsManager.java @@ -166,6 +166,7 @@ public class SettingsManager implements ListMenu.SettingsListener { private JSONObject mDependency; private int mCameraId; private Set<String> mFilteredKeys; + private int[] mExtendedHFRSize;//An array of pairs (fps, maxW, maxH) public Map<String, Values> getValuesMap() { return mValuesMap; @@ -287,6 +288,12 @@ public class SettingsManager implements ListMenu.SettingsListener { mValuesMap = new HashMap<>(); mDependendsOnMap = new HashMap<>(); mFilteredKeys = new HashSet<>(); + try { + mExtendedHFRSize = mCharacteristics.get(cameraId).get(CaptureModule.hfrSizeList); + }catch(IllegalArgumentException exception) { + exception.printStackTrace(); + } + filterPreferences(cameraId); initDependencyTable(); initializeValueMap(); @@ -926,7 +933,6 @@ public class SettingsManager implements ListMenu.SettingsListener { private List<String> getSupportedHighFrameRate() { ArrayList<String> supported = new ArrayList<String>(); supported.add("off"); - ListPreference videoQuality = mPreferenceGroup.findPreference(KEY_VIDEO_QUALITY); String videoSizeStr = videoQuality.getValue(); if (videoSizeStr != null) { @@ -944,11 +950,17 @@ public class SettingsManager implements ListMenu.SettingsListener { } catch (IllegalArgumentException ex) { Log.w(TAG, "HFR is not supported for this resolution " + ex); } - - // 60 fps goes through normal sesssion if it is supported by device - int maxFpsForNormalSession = getSupportedMaximumVideoFPSForNormalSession(mCameraId, videoSize); - supported.add("hfr" + maxFpsForNormalSession); - supported.add("hsr" + maxFpsForNormalSession); + if ( mExtendedHFRSize != null && mExtendedHFRSize.length >= 3 ) { + for( int i=0; i < mExtendedHFRSize.length; i+=3 ) { + String item = "hfr" + mExtendedHFRSize[i]; + if ( !supported.contains(item) + && videoSize.getWidth() <= mExtendedHFRSize[i+1] + && videoSize.getHeight() <= mExtendedHFRSize[i+2] ) { + supported.add(item); + supported.add("hsr"+mExtendedHFRSize[i]); + } + } + } } return supported; @@ -1101,37 +1113,6 @@ public class SettingsManager implements ListMenu.SettingsListener { return res; } - private boolean checkAeAvailableTargetFpsRanges(int cameraId, int fps) { - boolean supported = false; - Range[] aeFpsRanges = mCharacteristics.get(cameraId).get(CameraCharacteristics - .CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES); - - for (Range r : aeFpsRanges) { - Log.d(TAG, "["+r.getLower()+", "+r.getUpper()+"]"); - if ((fps <= (int)r.getUpper()) && - (fps >= (int)r.getLower())) { - supported = true; - break; - } - } - return supported; - } - - private int getSupportedMaximumVideoFPSForNormalSession(int cameraId, Size videoSize) { - StreamConfigurationMap map = mCharacteristics.get(cameraId).get( - CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); - long duration = map.getOutputMinFrameDuration(MediaRecorder.class, videoSize); - int fps = (int)(1000000000.0/duration); - if (!checkAeAvailableTargetFpsRanges(cameraId, fps)) { - Log.d(TAG, "FPS="+fps+" is not in available target FPS range"); - fps = 0; - } - Log.d(TAG, "Size="+videoSize.getWidth()+"x"+videoSize.getHeight()+ - ", Min Duration ="+duration+", Max fps=" + fps); - return fps; - } - - public Size[] getSupportedThumbnailSizes(int cameraId) { return mCharacteristics.get(cameraId).get( CameraCharacteristics.JPEG_AVAILABLE_THUMBNAIL_SIZES); |